浏览代码

新增接口申请

yhliang 3 年之前
父节点
当前提交
b1a7db0e71

+ 134 - 0
mybusiness/src/main/java/com/sooka/apply/controller/IntRecordController.java

@@ -0,0 +1,134 @@
+package com.sooka.apply.controller;
+
+import java.util.List;
+
+import com.sooka.apply.domain.IntBo;
+import com.sooka.apply.domain.IntDetailed;
+import com.sooka.common.annotation.Log;
+import com.sooka.common.core.controller.BaseController;
+import com.sooka.common.core.domain.AjaxResult;
+import com.sooka.common.core.page.TableDataInfo;
+import com.sooka.common.enums.BusinessType;
+import com.sooka.common.utils.poi.ExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.sooka.apply.domain.IntRecord;
+import com.sooka.apply.service.IIntRecordService;
+
+/**
+ * 申请记录Controller
+ * 
+ * @author yhliang
+ * @date 2021-07-06
+ */
+@Controller
+@RequestMapping("/apply/record")
+public class IntRecordController extends BaseController
+{
+    private String prefix = "apply/record";
+
+    @Autowired
+    private IIntRecordService intRecordService;
+
+    @RequiresPermissions("apply:record:view")
+    @GetMapping()
+    public String record()
+    {
+        return prefix + "/record";
+    }
+
+    /**
+     * 查询申请记录列表
+     */
+    @RequiresPermissions("apply:record:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(IntRecord intRecord)
+    {
+        startPage();
+        List<IntRecord> list = intRecordService.selectIntRecordList(intRecord);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出申请记录列表
+     */
+    @RequiresPermissions("apply:record:export")
+    @Log(title = "申请记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(IntRecord intRecord)
+    {
+        List<IntRecord> list = intRecordService.selectIntRecordList(intRecord);
+        ExcelUtil<IntRecord> util = new ExcelUtil<IntRecord>(IntRecord.class);
+        return util.exportExcel(list, "record");
+    }
+
+    /**
+     * 新增申请记录
+     */
+    @GetMapping("/add")
+    public String add()
+    {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存申请记录
+     */
+    @RequiresPermissions("apply:record:add")
+    @Log(title = "申请记录", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(IntBo intBo)
+    {
+        if (!IntBo.check(intBo)) {
+            return AjaxResult.error("丢失参数");
+        }
+        return toAjax(intRecordService.insertIntRecord(intBo));
+    }
+
+    /**
+     * 修改申请记录
+     */
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") String id, ModelMap mmap)
+    {
+        IntRecord intRecord = intRecordService.selectIntRecordById(id);
+        mmap.put("intRecord", intRecord);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 删除申请记录
+     */
+    @RequiresPermissions("apply:record:remove")
+    @Log(title = "申请记录", businessType = BusinessType.DELETE)
+    @PostMapping( "/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids)
+    {
+        return toAjax(intRecordService.deleteIntRecordByIds(ids));
+    }
+
+    /**
+     * 状态修改
+     */
+    @Log(title = "接口管理", businessType = BusinessType.UPDATE)
+    @RequiresPermissions("apply:record:edit")
+    @PostMapping("/changeStatus")
+    @ResponseBody
+    public AjaxResult changeStatus(IntDetailed intDetailed)
+    {
+        return toAjax(intRecordService.changeStatus(intDetailed));
+    }
+
+
+}

+ 70 - 0
mybusiness/src/main/java/com/sooka/apply/domain/IntBo.java

@@ -0,0 +1,70 @@
+package com.sooka.apply.domain;
+
+import com.sooka.common.utils.StringUtils;
+
+/******************************
+ * TODO
+ * @author yanhongliang
+ * @date 2021-07-07 1:20 PM
+ ******************************/
+
+public class IntBo {
+
+    private String id;
+
+    private String intIds;
+
+    private Long deptId;
+
+    private String datetime;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getIntIds() {
+        return intIds;
+    }
+
+    public void setIntIds(String intIds) {
+        this.intIds = intIds;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public String getDatetime() {
+        return datetime;
+    }
+
+    public void setDatetime(String datetime) {
+        this.datetime = datetime;
+    }
+
+    public static boolean check(IntBo intBo) {
+
+        return intBo != null &&
+                StringUtils.isNotEmpty(intBo.getIntIds()) &&
+                intBo.getDeptId() != 0 &&
+                StringUtils.isNotEmpty(intBo.getDatetime()) &&
+                intBo.datetime.split("-").length > 2;
+    }
+
+    @Override
+    public String toString() {
+        return "IntBo{" +
+                "id='" + id + '\'' +
+                ", deptId='" + deptId + '\'' +
+                ", datetime='" + datetime + '\'' +
+                '}';
+    }
+}

+ 122 - 0
mybusiness/src/main/java/com/sooka/apply/domain/IntDetailed.java

@@ -0,0 +1,122 @@
+package com.sooka.apply.domain;
+
+import com.sooka.common.annotation.Excel;
+import com.sooka.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 申请明细对象 int_detailed
+ * 
+ * @author yhliang
+ * @date 2021-07-06
+ */
+public class IntDetailed extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String id;
+
+    /** 记录表id */
+    @Excel(name = "记录表id")
+    private String recordId;
+
+    /** 接口表id */
+    @Excel(name = "接口表id")
+    private String intId;
+
+    /** 开始时间 */
+    @Excel(name = "开始时间")
+    private String strAt;
+
+    /** 结束时间 */
+    @Excel(name = "结束时间")
+    private String endAt;
+
+    /** secret_key */
+    @Excel(name = "secret_key")
+    private String secretKey;
+
+    /** 状态 */
+    @Excel(name = "状态")
+    private String status;
+
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+    public void setRecordId(String recordId) 
+    {
+        this.recordId = recordId;
+    }
+
+    public String getRecordId() 
+    {
+        return recordId;
+    }
+    public void setIntId(String intId)
+    {
+        this.intId = intId;
+    }
+
+    public String getIntId()
+    {
+        return intId;
+    }
+    public void setStrAt(String strAt) 
+    {
+        this.strAt = strAt;
+    }
+
+    public String getStrAt() 
+    {
+        return strAt;
+    }
+    public void setEndAt(String endAt) 
+    {
+        this.endAt = endAt;
+    }
+
+    public String getEndAt() 
+    {
+        return endAt;
+    }
+
+    public void setSecretKey(String secretKey)
+    {
+        this.secretKey = secretKey;
+    }
+
+    public String getSecretKey() 
+    {
+        return secretKey;
+    }
+    public void setStatus(String status) 
+    {
+        this.status = status;
+    }
+
+    public String getStatus() 
+    {
+        return status;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("recordId", getRecordId())
+            .append("intId", getIntId())
+            .append("strAt", getStrAt())
+            .append("endAt", getEndAt())
+            .append("secretKey", getSecretKey())
+            .append("status", getStatus())
+            .toString();
+    }
+}

+ 148 - 0
mybusiness/src/main/java/com/sooka/apply/domain/IntRecord.java

@@ -0,0 +1,148 @@
+package com.sooka.apply.domain;
+
+import java.util.List;
+import java.util.Date;
+
+import com.sooka.common.annotation.Excel;
+import com.sooka.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 申请记录对象 int_record
+ * 
+ * @author yhliang
+ * @date 2021-07-06
+ */
+public class IntRecord extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** null */
+    private String id;
+
+    /** 申请部门 */
+    private Long applyOid;
+
+    /** 申请部门 */
+    @Excel(name = "申请部门")
+    private String applyName;
+
+    /** 登记部门 */
+    private Long orgId;
+
+    /** 登记部门 */
+    @Excel(name = "登记部门")
+    private String orgName;
+
+    /** 申请时间 */
+    @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date applyTime;
+
+    /** 接口数量 */
+    @Excel(name = "接口数量")
+    private Integer intNumbers;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    private String remarks;
+
+    /** 申请明细信息 */
+    private List<IntDetailed> intDetailedList;
+
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    public String getId() 
+    {
+        return id;
+    }
+    public void setApplyOid(Long applyOid) 
+    {
+        this.applyOid = applyOid;
+    }
+
+    public Long getApplyOid() 
+    {
+        return applyOid;
+    }
+    public void setOrgId(Long orgId) 
+    {
+        this.orgId = orgId;
+    }
+
+    public Long getOrgId() 
+    {
+        return orgId;
+    }
+    public void setApplyTime(Date applyTime) 
+    {
+        this.applyTime = applyTime;
+    }
+
+    public Date getApplyTime() 
+    {
+        return applyTime;
+    }
+    public void setIntNumbers(Integer intNumbers)
+    {
+        this.intNumbers = intNumbers;
+    }
+
+    public Integer getIntNumbers()
+    {
+        return intNumbers;
+    }
+    public void setRemarks(String remarks)
+    {
+        this.remarks = remarks;
+    }
+
+    public String getRemarks()
+    {
+        return remarks;
+    }
+
+    public List<IntDetailed> getIntDetailedList()
+    {
+        return intDetailedList;
+    }
+
+    public void setIntDetailedList(List<IntDetailed> intDetailedList)
+    {
+        this.intDetailedList = intDetailedList;
+    }
+
+    public String getApplyName() {
+        return applyName;
+    }
+
+    public void setApplyName(String applyName) {
+        this.applyName = applyName;
+    }
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    @Override
+    public String toString() {
+        return "IntRecord{" +
+                "id='" + id + '\'' +
+                ", applyOid=" + applyOid +
+                ", applyName='" + applyName + '\'' +
+                ", orgId=" + orgId +
+                ", orgName='" + orgName + '\'' +
+                ", applyTime=" + applyTime +
+                ", intNumbers=" + intNumbers +
+                ", remarks='" + remarks + '\'' +
+                ", intDetailedList=" + intDetailedList +
+                '}';
+    }
+}

+ 71 - 0
mybusiness/src/main/java/com/sooka/apply/mapper/IntRecordMapper.java

@@ -0,0 +1,71 @@
+package com.sooka.apply.mapper;
+
+import java.util.List;
+import com.sooka.apply.domain.IntRecord;
+import com.sooka.apply.domain.IntDetailed;
+
+/**
+ * 申请记录Mapper接口
+ * 
+ * @author yhliang
+ * @date 2021-07-06
+ */
+public interface IntRecordMapper 
+{
+    /**
+     * 查询申请记录
+     * 
+     * @param id 申请记录ID
+     * @return 申请记录
+     */
+    public IntRecord selectIntRecordById(String id);
+
+    /**
+     * 查询申请记录列表
+     * 
+     * @param intRecord 申请记录
+     * @return 申请记录集合
+     */
+    public List<IntRecord> selectIntRecordList(IntRecord intRecord);
+
+    /**
+     * 新增申请记录
+     * 
+     * @param intRecord 申请记录
+     * @return 结果
+     */
+    public int insertIntRecord(IntRecord intRecord);
+
+    /**
+     * 批量删除申请记录
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteIntRecordByIds(String[] ids);
+
+    /**
+     * 批量删除申请明细
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteIntDetailedByRecordIds(String[] ids);
+    
+    /**
+     * 批量新增申请明细
+     * 
+     * @param intDetailedList 申请明细列表
+     * @return 结果
+     */
+    public int batchIntDetailed(List<IntDetailed> intDetailedList);
+
+    /**
+     * 状态修改
+     *
+     * @param intDetailed 接口信息
+     * @return 结果
+     */
+    public int changeStatus(IntDetailed intDetailed);
+
+}

+ 57 - 0
mybusiness/src/main/java/com/sooka/apply/service/IIntRecordService.java

@@ -0,0 +1,57 @@
+package com.sooka.apply.service;
+
+import java.util.List;
+
+import com.sooka.apply.domain.IntBo;
+import com.sooka.apply.domain.IntDetailed;
+import com.sooka.apply.domain.IntRecord;
+
+/**
+ * 申请记录Service接口
+ * 
+ * @author yhliang
+ * @date 2021-07-06
+ */
+public interface IIntRecordService 
+{
+    /**
+     * 查询申请记录
+     * 
+     * @param id 申请记录ID
+     * @return 申请记录
+     */
+    public IntRecord selectIntRecordById(String id);
+
+    /**
+     * 查询申请记录列表
+     * 
+     * @param intRecord 申请记录
+     * @return 申请记录集合
+     */
+    public List<IntRecord> selectIntRecordList(IntRecord intRecord);
+
+    /**
+     * 新增申请记录
+     * 
+     * @param intBo 申请记录
+     * @return 结果
+     */
+    public int insertIntRecord(IntBo intBo);
+
+    /**
+     * 批量删除申请记录
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteIntRecordByIds(String ids);
+
+    /**
+     * 状态修改
+     *
+     * @param intDetailed 接口信息
+     * @return 结果
+     */
+    public int changeStatus(IntDetailed intDetailed);
+
+}

+ 142 - 0
mybusiness/src/main/java/com/sooka/apply/service/impl/IntRecordServiceImpl.java

@@ -0,0 +1,142 @@
+package com.sooka.apply.service.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.sooka.apply.domain.IntBo;
+import com.sooka.common.core.text.Convert;
+import com.sooka.common.utils.DateUtils;
+import com.sooka.common.utils.StringUtils;
+import com.sooka.common.utils.uuid.IdUtils;
+import com.sooka.common.utils.uuid.UUID;
+import com.sooka.framework.util.ShiroUtils;
+import com.sooka.system.domain.SysUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import org.springframework.transaction.annotation.Transactional;
+import com.sooka.apply.domain.IntDetailed;
+import com.sooka.apply.mapper.IntRecordMapper;
+import com.sooka.apply.domain.IntRecord;
+import com.sooka.apply.service.IIntRecordService;
+
+/**
+ * 申请记录Service业务层处理
+ * 
+ * @author yhliang
+ * @date 2021-07-06
+ */
+@Service
+public class IntRecordServiceImpl implements IIntRecordService 
+{
+    @Autowired
+    private IntRecordMapper intRecordMapper;
+
+    /**
+     * 查询申请记录
+     * 
+     * @param id 申请记录ID
+     * @return 申请记录
+     */
+    @Override
+    public IntRecord selectIntRecordById(String id)
+    {
+        return intRecordMapper.selectIntRecordById(id);
+    }
+
+    /**
+     * 查询申请记录列表
+     * 
+     * @param intRecord 申请记录
+     * @return 申请记录
+     */
+    @Override
+    public List<IntRecord> selectIntRecordList(IntRecord intRecord)
+    {
+        return intRecordMapper.selectIntRecordList(intRecord);
+    }
+
+    /**
+     * 新增申请记录
+     * 
+     * @param intBo 申请记录
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int insertIntRecord(IntBo intBo)
+    {
+
+        SysUser user = ShiroUtils.getSysUser();
+
+        IntRecord intRecord = new IntRecord();
+        intRecord.setId(IdUtils.fastSimpleUUID());
+        intRecord.setApplyOid(intBo.getDeptId());
+        intRecord.setOrgId(user.getDeptId());
+        intRecord.setApplyTime(DateUtils.getNowDate());
+        intRecord.setIntNumbers(intBo.getIntIds().split(",").length);
+
+        intBo.setId(intRecord.getId());
+
+        int rows = intRecordMapper.insertIntRecord(intRecord);
+        insertIntDetailed(intBo);
+        return rows;
+    }
+
+    /**
+     * 删除申请记录对象
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int deleteIntRecordByIds(String ids)
+    {
+        intRecordMapper.deleteIntDetailedByRecordIds(Convert.toStrArray(ids));
+        return intRecordMapper.deleteIntRecordByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 状态修改
+     *
+     * @param intDetailed 接口信息
+     * @return 结果
+     */
+    @Override
+    public int changeStatus(IntDetailed intDetailed) {
+        System.out.println(intDetailed.toString());
+        return intRecordMapper.changeStatus(intDetailed);
+    }
+
+    /**
+     * 新增申请明细信息
+     * 
+     * @param intBo 申请记录对象
+     */
+    private void insertIntDetailed(IntBo intBo)
+    {
+
+        String[] intIds = intBo.getIntIds().split(",");
+        String id = intBo.getId();
+        String str_at = intBo.getDatetime().split(" - ")[0];
+        String end_at = intBo.getDatetime().split(" - ")[1];
+
+        List<IntDetailed> list = new ArrayList<IntDetailed>();
+        for (String intId : intIds) {
+            IntDetailed intDetailed = new IntDetailed();
+            intDetailed.setId(IdUtils.fastSimpleUUID());
+            intDetailed.setIntId(intId);
+            intDetailed.setRecordId(id);
+            intDetailed.setStrAt(str_at);
+            intDetailed.setEndAt(end_at);
+            intDetailed.setSecretKey(IdUtils.fastSimpleUUID());
+            intDetailed.setStatus("1");
+            list.add(intDetailed);
+        }
+        if (list.size() > 0) {
+            System.out.println(Arrays.toString(list.toArray()));
+            intRecordMapper.batchIntDetailed(list);
+        }
+    }
+}

+ 119 - 0
mybusiness/src/main/resources/mapper/apply/IntRecordMapper.xml

@@ -0,0 +1,119 @@
+<?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.sooka.apply.mapper.IntRecordMapper">
+    
+    <resultMap type="IntRecord" id="IntRecordResult">
+        <result property="id"    column="id"    />
+        <result property="applyOid"    column="apply_oid"    />
+        <result property="applyName"    column="apply_name"    />
+        <result property="orgId"    column="org_id"    />
+        <result property="orgName"    column="org_name"    />
+        <result property="applyTime"    column="apply_time"    />
+        <result property="intNumbers"    column="int_numbers"    />
+    </resultMap>
+
+    <resultMap id="IntRecordIntDetailedResult" type="IntRecord" extends="IntRecordResult">
+        <collection property="intDetailedList" notNullColumn="id" javaType="java.util.List" resultMap="IntDetailedResult" />
+    </resultMap>
+
+    <resultMap type="IntDetailed" id="IntDetailedResult">
+        <result property="id"    column="id"    />
+        <result property="recordId"    column="record_id"    />
+        <result property="intId"    column="int_id"    />
+        <result property="strAt"    column="str_at"    />
+        <result property="endAt"    column="end_at"    />
+        <result property="secretKey"    column="secret_key"    />
+        <result property="status"    column="status"    />
+    </resultMap>
+
+    <sql id="selectIntRecordVo">
+        SELECT
+            i.id,
+            i.apply_oid,
+            d1.dept_name apply_name,
+            i.org_id,
+            d2.dept_name org_name,
+            i.apply_time,
+            i.int_numbers
+        FROM
+            int_record i,
+            sys_dept d1,
+            sys_dept d2
+        WHERE
+            d1.dept_id = i.apply_oid
+          AND d2.dept_id = i.org_id
+    </sql>
+
+    <select id="selectIntRecordList" parameterType="IntRecord" resultMap="IntRecordResult">
+        <include refid="selectIntRecordVo"/>
+        <where>  
+            <if test="applyOid != null "> and apply_oid = #{applyOid}</if>
+            <if test="orgId != null "> and org_id = #{orgId}</if>
+            <if test="applyTime != null "> and apply_time = #{applyTime}</if>
+            <if test="intNumbers != null "> and int_numbers = #{intNumbers}</if>
+        </where>
+        ORDER BY i.apply_time DESC
+    </select>
+    
+    <select id="selectIntRecordById" parameterType="String" resultMap="IntRecordIntDetailedResult">
+        select a.id, a.apply_oid, a.org_id, a.apply_time, a.int_numbers,
+            b.id, b.record_id, b.int_id, b.str_at, b.end_at, b.secret_key, b.status
+        from int_record a
+        left join int_detailed b on b.record_id = a.id
+        where a.id = #{id}
+    </select>
+        
+    <insert id="insertIntRecord" parameterType="IntRecord">
+        insert into int_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="applyOid != null">apply_oid,</if>
+            <if test="orgId != null">org_id,</if>
+            <if test="applyTime != null">apply_time,</if>
+            <if test="intNumbers != null">int_numbers,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="applyOid != null">#{applyOid},</if>
+            <if test="orgId != null">#{orgId},</if>
+            <if test="applyTime != null">#{applyTime},</if>
+            <if test="intNumbers != null">#{intNumbers},</if>
+         </trim>
+    </insert>
+
+    <update id="aa" parameterType="IntDetailed">
+
+    </update>
+
+    <update id="changeStatus" parameterType="IntDetailed">
+        update int_detailed
+        <set>
+            <if test="status != null and status != ''">status = #{status},</if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteIntRecordByIds" parameterType="String">
+        delete from int_record where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+    <delete id="deleteIntDetailedByRecordIds" parameterType="String">
+        delete from int_detailed where record_id in 
+        <foreach item="recordId" collection="array" open="(" separator="," close=")">
+            #{recordId}
+        </foreach>
+    </delete>
+
+    <insert id="batchIntDetailed">
+        insert into int_detailed( id, record_id, int_id, str_at, end_at, secret_key, status) values
+		<foreach item="item" index="index" collection="list" separator=",">
+            ( #{item.id}, #{item.recordId}, #{item.intId}, #{item.strAt}, #{item.endAt}, #{item.secretKey}, #{item.status})
+        </foreach>
+    </insert>
+
+</mapper>

+ 167 - 0
mybusiness/src/main/resources/templates/apply/record/add.html

@@ -0,0 +1,167 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('用户列表')" />
+    <th:block th:include="include :: layout-latest-css" />
+    <th:block th:include="include :: ztree-css" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="gray-bg">
+    <form class="form-horizontal m" id="form-record-add">
+
+        <div class="ui-layout-west">
+            <div class="box box-main">
+                <div class="box-header">
+                    <div class="box-title">
+                        <i class="fa icon-grid"></i> 组织机构
+                    </div>
+                    <div class="box-tools pull-right">
+                        <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
+                        <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
+                        <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
+                    </div>
+                </div>
+                <div class="ui-layout-content">
+                    <div id="tree" class="ztree"></div>
+                </div>
+            </div>
+        </div>
+
+        <div class="ui-layout-center">
+            <div class="container-div">
+                <div class="row">
+                    <div class="btn-group-sm" id="toolbar" role="group">
+                        <a class="btn btn-success">
+                            <input type="hidden" id="deptId" name="deptId">
+                            <span id="deptName">请选择部门</span>
+                        </a>
+                        <div class="input-group date">
+                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                            <input type="text" class="form-control" id="datetime" name="datetime" placeholder="yyyy-MM-dd - yyyy-MM-dd" required>
+                        </div>
+                    </div>
+                    <div class="col-sm-12 select-table table-striped">
+                        <input type="hidden" id="intIds" name="intIds">
+                        <table id="bootstrap-table"></table>
+                    </div>
+                </div>
+                </div>
+            </div>
+        </div>
+    </form>
+<th:block th:include="include :: footer" />
+<th:block th:include="include :: layout-latest-js" />
+<th:block th:include="include :: ztree-js" />
+<th:block th:include="include :: datetimepicker-js" />
+<script th:inline="javascript">
+
+    var prefix = ctx + "system";
+    var datas = [[${@dict.getType('share_type')}]];
+    var apply_prefix = ctx + "apply/record"
+    $("#form-record-add").validate({
+        rules:{
+            deptId: "required",
+            id: "required"
+        },
+        messages: {
+            deptId: "请选择部门",
+            id: "请选择接口"
+        },
+        ignore: "",//不验证的元素
+        focusCleanup: true
+    });
+
+    $(function() {
+        var panehHidden = false;
+        if ($(this).width() < 769) {
+            panehHidden = true;
+        }
+        $('body').layout({ initClosed: panehHidden, west__size: 185 });
+        <!-- laydate示例 -->
+        layui.use('laydate', function(){
+            var laydate = layui.laydate;
+            laydate.render({
+                elem: '#datetime',
+                range: true
+            });
+        });
+        queryUserList();
+        queryDeptTree();
+    });
+
+    function queryUserList() {
+        var options = {
+            url: prefix + "/interfaceinfo/list",
+            showSearch: false,
+            showColumns: false,
+            showToggle: false,
+            rememberSelected: true,
+            columns: [{
+                field: 'state',
+                checkbox: true
+            },{
+                field: 'interfaceName',
+                title: '接口名称'
+            },{
+                field: 'usageScenarios',
+                title: '使用场景'
+            },{
+                field: 'shareType',
+                title: '共享方式',
+                formatter: function(value, item, index) {
+                    return $.table.selectDictLabel(datas, item.shareType);
+                }
+            }]
+        };
+        $.table.init(options);
+    }
+
+    function queryDeptTree()
+    {
+        var url = prefix + "/dept/treeData";
+        var options = {
+            url: url,
+            expandLevel: 2,
+            onClick : zOnClick
+        };
+        $.tree.init(options);
+
+        function zOnClick(event, treeId, treeNode) {
+            $("#deptName").html(treeNode.name);
+            $('#deptId').val(treeNode.id);
+        }
+    }
+
+    // 选中数据
+    function checkItem(){
+        // var arrays = $.table.selectColumns("userId");
+        var arrays = $.table.selectColumns("id");
+        $("#intIds").val(arrays);
+    }
+
+    $('#btnExpand').click(function() {
+        $._tree.expandAll(true);
+        $(this).hide();
+        $('#btnCollapse').show();
+    });
+
+    $('#btnCollapse').click(function() {
+        $._tree.expandAll(false);
+        $(this).hide();
+        $('#btnExpand').show();
+    });
+
+    $('#btnRefresh').click(function() {
+        queryDeptTree();
+    });
+
+    function submitHandler() {
+        checkItem();
+        if ($.validate.form()) {
+            $.operate.save(apply_prefix + "/add", $('#form-record-add').serialize());
+        }
+    }
+
+</script>
+</body>
+</html>

+ 183 - 0
mybusiness/src/main/resources/templates/apply/record/add1.html

@@ -0,0 +1,183 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('新增申请记录')" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-record-add">
+            <h4 class="form-header h4">申请记录信息</h4>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">申请部门:</label>
+                <div class="col-sm-8">
+                    <input name="applyOid" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">登记部门:</label>
+                <div class="col-sm-8">
+                    <input name="orgId" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">申请时间:</label>
+                <div class="col-sm-8">
+                    <div class="input-group date">
+                        <input name="applyTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                    </div>
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">接口数量:</label>
+                <div class="col-sm-8">
+                    <input name="intNumbers" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">备注:</label>
+                <div class="col-sm-8">
+                    <input name="remarks" class="form-control" type="text">
+                </div>
+            </div>
+            <h4 class="form-header h4">申请明细信息</h4>
+            <div class="row">
+                <div class="col-sm-12">
+                    <button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
+                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
+                    <div class="col-sm-12 select-table table-striped">
+                        <table id="bootstrap-table"></table>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <th:block th:include="include :: datetimepicker-js" />
+    <script th:inline="javascript">
+        var prefix = ctx + "apply/record"
+        $("#form-record-add").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/add", $('#form-record-add').serialize());
+            }
+        }
+
+        $("input[name='applyTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $(function() {
+            var options = {
+                pagination: false,
+                showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+                    formatter: function (value, row, index) {
+                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                    	return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'intId',
+                    align: 'center',
+                    title: '接口表id',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].intId' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'strAt',
+                    align: 'center',
+                    title: '开始时间',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].strAt' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'endAt',
+                    align: 'center',
+                    title: '结束时间',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].endAt' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'accessId',
+                    align: 'center',
+                    title: 'access_id',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].accessId' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'secretKey',
+                    align: 'center',
+                    title: 'secret_key',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].secretKey' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'status',
+                    align: 'center',
+                    title: '状态',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].status' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'remarks',
+                    align: 'center',
+                    title: '备注',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='intDetailedList[%s].remarks' value='%s'>", index, value);
+                        return html;
+                    }
+                
+                }]
+            };
+            $.table.init(options);
+        });
+
+        function addColumn() {
+            var count = $("#" + table.options.id).bootstrapTable('getData').length;
+            sub.editColumn();
+        	
+            $("#" + table.options.id).bootstrapTable('insertRow', {
+                index: count,
+                row: {
+                    index: $.table.serialNumber(count),
+                    intId: "",
+                    strAt: "",
+                    endAt: "",
+                    accessId: "",
+                    secretKey: "",
+                    status: "",
+                    remarks: ""
+                }
+            });
+        }
+    </script>
+</body>
+</html>

+ 96 - 0
mybusiness/src/main/resources/templates/apply/record/edit.html

@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改申请记录')" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="white-bg">
+    <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="col-sm-12 select-table table-striped">
+                    <table id="bootstrap-table"></table>
+                </div>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+
+        var editFlag = [[${@permission.hasPermi('apply:record:edit')}]];
+        var prefix = ctx + "apply/record";
+
+        function submitHandler() {
+
+        }
+
+        $(function() {
+            var options = {
+                data: [[${intRecord.intDetailedList}]],
+                pagination: false,
+                showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                columns: [{
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+                    formatter: function (value, row, index) {
+                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                    	return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'strAt',
+                    align: 'center',
+                    title: '开始时间'
+				},
+                {
+                    field: 'endAt',
+                    align: 'center',
+                    title: '结束时间'
+				},
+                {
+                    field: 'secretKey',
+                    align: 'center',
+                    title: 'secret_key'
+				},
+                {
+                    visible: editFlag == 'hidden' ? false : true,
+                    title: '状态',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        return statusTools(row);
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+
+        /* 状态显示 */
+        function statusTools(row) {
+            if (row.status === '0') {
+                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
+            } else {
+                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
+            }
+        }
+
+        /* 接口管理-停用 */
+        function disable(id) {
+            $.modal.confirm("确认要停用该接口吗?", function() {
+                $.operate.post(prefix + "/changeStatus", { "id": id, "status": 0 });
+            })
+        }
+
+        /* 接口管理-启用 */
+        function enable(id) {
+            $.modal.confirm("确认要启用该接口吗?", function() {
+                $.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
+            })
+        }
+
+    </script>
+</body>
+</html>

+ 116 - 0
mybusiness/src/main/resources/templates/apply/record/record.html

@@ -0,0 +1,116 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('申请记录列表')" />
+</head>
+<body class="gray-bg">
+     <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="formId">
+                    <div class="select-list">
+                        <ul>
+                            <li>
+                                <label>申请部门:</label>
+                                <input type="text" name="applyOid"/>
+                            </li>
+                            <li>
+                                <label>登记部门:</label>
+                                <input type="text" name="orgId"/>
+                            </li>
+                            <li class="select-time">
+                                <label>申请时间:</label>
+                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginApplyTime]"/>
+                                <span>-</span>
+                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endApplyTime]"/>
+                            </li>
+                            <li>
+                                <label>接口数量:</label>
+                                <input type="text" name="intNumbers"/>
+                            </li>
+                            <li>
+                                <label>备注:</label>
+                                <input type="text" name="remarks"/>
+                            </li>
+                            <li>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </li>
+                        </ul>
+                    </div>
+                </form>
+            </div>
+
+            <div class="btn-group-sm" id="toolbar" role="group">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="apply:record:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="apply:record:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="apply:record:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="apply:record:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+            </div>
+            <div class="col-sm-12 select-table table-striped">
+                <table id="bootstrap-table"></table>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var editFlag = [[${@permission.hasPermi('apply:record:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('apply:record:remove')}]];
+        var prefix = ctx + "apply/record";
+
+        $(function() {
+            var options = {
+                url: prefix + "/list",
+                createUrl: prefix + "/add",
+                updateUrl: prefix + "/edit/{id}",
+                removeUrl: prefix + "/remove",
+                exportUrl: prefix + "/export",
+                modalName: "申请记录",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'id',
+                    title: 'null',
+                    visible: false
+                },
+                {
+                    field: 'applyName',
+                    title: '申请部门'
+                },
+                {
+                    field: 'orgName',
+                    title: '登记部门'
+                },
+                {
+                    field: 'applyTime',
+                    title: '申请时间'
+                },
+                {
+                    field: 'intNumbers',
+                    title: '接口数量'
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+    </script>
+</body>
+</html>