Kaynağa Gözat

中台-接口申请

limeng 2 yıl önce
ebeveyn
işleme
782ebe7c8c

+ 9 - 7
mybusiness/src/main/java/com/sooka/apply/controller/IntRecordController.java

@@ -10,6 +10,8 @@ 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 com.sooka.framework.util.ShiroUtils;
+import com.sooka.system.domain.SysUser;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -24,7 +26,7 @@ import com.sooka.apply.service.IIntRecordService;
 
 /**
  * 申请记录Controller
- * 
+ *
  * @author yhliang
  * @date 2021-07-06
  */
@@ -88,8 +90,11 @@ public class IntRecordController extends BaseController
      * 新增申请记录
      */
     @GetMapping("/add")
-    public String add()
+    public String add(ModelMap mmap)
     {
+        SysUser sysUser = ShiroUtils.getSysUser();
+        mmap.put("applyDeptName", sysUser.getDept().getDeptName());
+        mmap.put("applyUserName", sysUser.getUserName());
         return prefix + "/add";
     }
 
@@ -100,12 +105,9 @@ public class IntRecordController extends BaseController
     @Log(title = "申请记录", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @ResponseBody
-    public AjaxResult addSave(IntBo intBo)
+    public AjaxResult addSave(IntRecord intRecord)
     {
-        if (!IntBo.check(intBo)) {
-            return AjaxResult.error("丢失参数");
-        }
-        return toAjax(intRecordService.insertIntRecord(intBo));
+        return toAjax(intRecordService.insertIntRecord(intRecord));
     }
 
     /**

+ 39 - 110
mybusiness/src/main/java/com/sooka/apply/domain/IntRecord.java

@@ -5,15 +5,17 @@ import java.util.Date;
 
 import com.sooka.common.annotation.Excel;
 import com.sooka.common.core.domain.BaseEntity;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 申请记录对象 int_record
- * 
+ *
  * @author yhliang
  * @date 2021-07-06
  */
+@Data
 public class IntRecord extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -21,128 +23,55 @@ public class IntRecord extends BaseEntity
     /** null */
     private String id;
 
-    /** 申请部门 */
-    private Long applyOid;
+    /** 申请部门ID */
+    private Long applyDeptId;
 
     /** 申请部门 */
     @Excel(name = "申请部门")
-    private String applyName;
+    private String applyDeptName;
+
+    /** 申请人ID */
+    private Long applyUserId;
+
+    /** 申请人 */
+    @Excel(name = "申请人")
+    private String applyUserName;
+
+    /** 联系方式 */
+    @Excel(name = "联系方式")
+    private String tel;
 
-    /** 登记部门 */
-    private Long orgId;
+    /** 调用者IP */
+    @Excel(name = "调用者IP")
+    private String ip;
 
-    /** 登记部门 */
-    @Excel(name = "登记部门")
-    private String orgName;
+    /** 提供部门ID */
+    private String provideDeptId;
+
+    /** 提供部门 */
+    @Excel(name = "提供部门")
+    private String provideDeptName;
 
     /** 申请时间 */
     @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date applyTime;
 
-    /** 接口数量 */
-    @Excel(name = "接口数量")
-    private Integer intNumbers;
+    /** 调用频率 */
+    @Excel(name = "调用频率")
+    private Integer frequency;
+
+    /** 使用时效开始时间 */
+    @Excel(name = "使用时效开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Integer startTime;
+
+    /** 使用时效结束时间 */
+    @Excel(name = "使用时效结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private String endTime;
 
-    /** 备注 */
-    @Excel(name = "备注")
-    private String remarks;
+    /** 起止时间 */
+    private String duration;
 
     /** 申请明细信息 */
     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 +
-                '}';
-    }
 }

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

@@ -8,15 +8,15 @@ import com.sooka.apply.domain.IntRecord;
 
 /**
  * 申请记录Service接口
- * 
+ *
  * @author yhliang
  * @date 2021-07-06
  */
-public interface IIntRecordService 
+public interface IIntRecordService
 {
     /**
      * 查询申请记录
-     * 
+     *
      * @param id 申请记录ID
      * @return 申请记录
      */
@@ -24,7 +24,7 @@ public interface IIntRecordService
 
     /**
      * 查询申请记录列表
-     * 
+     *
      * @param intRecord 申请记录
      * @return 申请记录集合
      */
@@ -40,11 +40,11 @@ public interface IIntRecordService
 
     /**
      * 新增申请记录
-     * 
+     *
      * @param intBo 申请记录
      * @return 结果
      */
-    public int insertIntRecord(IntBo intBo);
+    public int insertIntRecord(IntRecord intBo);
 
     /**
      * 批量删除申请记录

+ 11 - 29
mybusiness/src/main/java/com/sooka/apply/service/impl/IntRecordServiceImpl.java

@@ -22,19 +22,19 @@ import com.sooka.apply.service.IIntRecordService;
 
 /**
  * 申请记录Service业务层处理
- * 
+ *
  * @author yhliang
  * @date 2021-07-06
  */
 @Service
-public class IntRecordServiceImpl implements IIntRecordService 
+public class IntRecordServiceImpl implements IIntRecordService
 {
     @Autowired
     private IntRecordMapper intRecordMapper;
 
     /**
      * 查询申请记录
-     * 
+     *
      * @param id 申请记录ID
      * @return 申请记录
      */
@@ -46,7 +46,7 @@ public class IntRecordServiceImpl implements IIntRecordService
 
     /**
      * 查询申请记录列表
-     * 
+     *
      * @param intRecord 申请记录
      * @return 申请记录
      */
@@ -69,33 +69,15 @@ public class IntRecordServiceImpl implements IIntRecordService
 
     /**
      * 新增申请记录
-     * 
-     * @param intBo 申请记录
+     *
+     * @param intRecord 申请记录
      * @return 结果
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     @Override
-    public int insertIntRecord(IntBo intBo)
+    public int insertIntRecord(IntRecord intRecord)
     {
-
-        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());
-
-        try {
-            insertIntDetailed(intBo);
-            return intRecordMapper.insertIntRecord(intRecord);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return 0;
+        return intRecordMapper.insertIntRecord(intRecord);
     }
 
     /**
@@ -126,7 +108,7 @@ public class IntRecordServiceImpl implements IIntRecordService
 
     /**
      * 新增申请明细信息
-     * 
+     *
      * @param intBo 申请记录对象
      */
     private void insertIntDetailed(IntBo intBo) throws Exception {
@@ -158,7 +140,7 @@ public class IntRecordServiceImpl implements IIntRecordService
             intDetailed.setStatus("1");
             list.add(intDetailed);
         }
-        
+
         if (list.size() > 0) {
             intRecordMapper.batchIntDetailed(list);
         }

+ 55 - 40
mybusiness/src/main/resources/mapper/apply/IntRecordMapper.xml

@@ -3,15 +3,21 @@
 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="applyDeptId"    column="apply_dept_id"    />
+        <result property="applyDeptName"    column="apply_dept_name"    />
+        <result property="applyUserId"    column="apply_user_id"    />
+        <result property="applyUserName"    column="apply_user_name"    />
+        <result property="tel"    column="tel"    />
+        <result property="ip"    column="ip"    />
+        <result property="provideDeptId"    column="provide_dept_id"    />
+        <result property="provideDeptName"    column="provide_dept_name"    />
         <result property="applyTime"    column="apply_time"    />
-        <result property="intNumbers"    column="int_numbers"    />
+        <result property="frequency"    column="frequency"    />
+        <result property="startTime"    column="start_time"    />
+        <result property="endTime"    column="end_time"    />
     </resultMap>
 
     <resultMap id="IntRecordIntDetailedResult" type="IntRecord" extends="IntRecordResult">
@@ -32,20 +38,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <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
+            id,
+            apply_dept_id,
+            apply_dept_name,
+            apply_user_id,
+            apply_user_name,
+            tel,
+            ip,
+            provide_dept_id,
+            provide_dept_name,
+            apply_time,
+            frequency,
+            start_time,
+            end_time
         FROM
-            int_record i,
-            sys_dept d1,
-            sys_dept d2
-        WHERE
-            d1.dept_id = i.apply_oid
-          AND d2.dept_id = i.org_id
+            int_record
     </sql>
 
     <sql id="selectIntDetailedVo">
@@ -68,13 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <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
+        ORDER BY apply_time DESC
     </select>
 
     <select id="selectIntDetailedList" parameterType="IntDetailed" resultMap="IntDetailedResult">
@@ -82,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="recordId != null "> and b.record_id = #{recordId}</if>
         order by b.int_code
     </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
@@ -90,22 +91,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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="applyDeptId != null">apply_dept_id,</if>
+            <if test="applyDeptName != null">apply_dept_name,</if>
+            <if test="applyUserId != null">apply_user_id,</if>
+            <if test="applyUserName != null">apply_user_name,</if>
+            <if test="tel != null">tel,</if>
+            <if test="ip != null">ip,</if>
+            <if test="provideDeptId != null">provide_dept_id,</if>
+            <if test="provideDeptName != null">provide_dept_name,</if>
             <if test="applyTime != null">apply_time,</if>
-            <if test="intNumbers != null">int_numbers,</if>
+            <if test="frequency != null">frequency,</if>
+            <if test="startTime != null">startTime,</if>
+            <if test="endTime != null">endTime,</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="applyDeptId != null">#{applyDeptId},</if>
+            <if test="applyDeptName != null">#{applyDeptName},</if>
+            <if test="applyUserId != null">#{applyUserId},</if>
+            <if test="applyUserName != null">#{applyUserName},</if>
+            <if test="tel != null">#{tel},</if>
+            <if test="ip != null">#{ip},</if>
+            <if test="provideDeptId != null">#{provideDeptId},</if>
+            <if test="provideDeptName != null">#{provideDeptName},</if>
             <if test="applyTime != null">#{applyTime},</if>
-            <if test="intNumbers != null">#{intNumbers},</if>
+            <if test="frequency != null">#{frequency},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
          </trim>
     </insert>
 
@@ -122,14 +137,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteIntRecordByIds" parameterType="String">
-        delete from int_record where id in 
+        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 
+        delete from int_detailed where record_id in
         <foreach item="recordId" collection="array" open="(" separator="," close=")">
             #{recordId}
         </foreach>
@@ -142,4 +157,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </insert>
 
-</mapper>
+</mapper>

+ 47 - 46
mybusiness/src/main/resources/templates/apply/record/add.html

@@ -25,32 +25,33 @@
             <!--主表字段start-->
             <div class="ibox">
                 <div class="ibox-content">
-                    <form method="get" class="form-horizontal">
+                    <form method="get" class="form-horizontal" id="form-record-add">
                         <div class="form-group">
                             <label class="col-sm-2 control-label">申请部门名称</label>
                             <div class="col-sm-4">
-                                <input type="text" class="form-control">
+                                <input type="text" disabled class="form-control" th:value="${applyDeptName}">
                             </div>
                             <label class="col-sm-2 control-label">申请人</label>
                             <div class="col-sm-4">
-                                <input type="text" class="form-control">
+                                <input type="text" disabled class="form-control" th:value="${applyUserName}">
                             </div>
                         </div>
                         <div class="form-group">
                             <label class="col-sm-2 control-label">联系方式</label>
                             <div class="col-sm-4">
-                                <input type="text" class="form-control">
+                                <input type="text" name="tel" class="form-control">
                             </div>
                             <label class="col-sm-2 control-label">调用者IP</label>
                             <div class="col-sm-4">
-                                <input type="input" class="form-control" name="">
+                                <input type="input" name="ip" class="form-control">
                             </div>
                         </div>
                         <div class="form-group">
                             <label class="col-sm-2 control-label">提供接口部门</label>
                             <div class="col-sm-10">
                                 <div class="input-group">
-                                    <input name="deptName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择归属部门" class="form-control" required>
+                                    <input name="provideDeptName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择归属部门" class="form-control" required>
+                                    <input name="provideDeptId" type="hidden" id="treeId"/>
                                     <span class="input-group-addon"><i class="fa fa-search"></i></span>
                                 </div>
                             </div>
@@ -58,13 +59,13 @@
                         <div class="form-group">
                             <label class="col-sm-2 control-label">每天调用频率</label>
                             <div class="col-sm-4">
-                                <input type="input" class="form-control" name="">
+                                <input type="input" class="form-control" name="frequency">
                             </div>
                             <label class="col-sm-2 control-label">使用时效</label>
                             <div class="col-sm-4">
                                 <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="从 - 至" required>
+                                    <input type="text" class="form-control" id="duration" name="duration" placeholder="从 - 至" required>
                                 </div>
                             </div>
                         </div>
@@ -83,8 +84,8 @@
                             <div class="panel panel-default">
                                 <div class="panel-heading">
                                     <h5 class="panel-title">
-                                        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">吉林省-契税完税证信息-数据查询接口</a>
-                                        <span class="panel_sj"></span>
+                                        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" onclick="openOrClose(this)">吉林省-契税完税证信息-数据查询接口</a>
+                                        <span class="panel_sj on" name="collapseOne"></span>
                                     </h5>
                                 </div>
                                 <div id="collapseOne" class="panel-collapse collapse">
@@ -112,39 +113,6 @@
                                     </div>
                                 </div>
                             </div>
-                            <div class="panel panel-default">
-                                <div class="panel-heading">
-                                    <h5 class="panel-title">
-                                        <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">归集-市房地产-备案补录信息	</a>
-                                        <span class="panel_sj on"></span>
-                                    </h5>
-                                </div>
-                                <div id="collapse2" class="panel-collapse collapse">
-                                    <div class="panel-body">
-                                        <form class="form-horizontal">
-                                            <div class="form-group">
-                                                <label class="col-sm-2 control-label">接口地址</label>
-                                                <div class="col-sm-10">
-                                                    <input type="text" class="form-control"  disabled name="/api/jptssta/getQsWszInfo">
-                                                </div>
-                                            </div>
-                                            <div class="form-group">
-                                                <label class="col-sm-2 control-label">接口用途</label>
-                                                <div class="col-sm-10">
-                                                    <input type="text" class="form-control"  disabled name="">
-                                                </div>
-                                            </div>
-                                            <div class="form-group">
-                                                <label class="col-sm-2 control-label">附件</label>
-                                                <div class="col-sm-10">
-                                                    <input class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
-                                                </div>
-                                            </div>
-                                        </form>
-                                    </div>
-                                </div>
-                            </div>
-
                         </div>
                     </div>
                 </div>
@@ -152,6 +120,13 @@
             <!--接口end-->
         </div>
     </div>
+</div>
+<div class="row">
+    <div class="col-sm-offset-5 col-sm-10">
+        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
+        <button type="button" class="btn btn-sm btn-danger" onclick=""><i class="fa fa-reply-all"></i>关 闭 </button>
+    </div>
+</div>
 </body>
 
 <th:block th:include="include :: footer" />
@@ -166,18 +141,44 @@
     let prefix = ctx + "system";
     let datas = [[${@dict.getType('share_type')}]];
     let apply_prefix = ctx + "apply/record"
+    let deptName = "提供部门";
 
     $(function() {
         /** 范围选择日期框 **/
         layui.use('laydate', function(){
             let laydate = layui.laydate;
             laydate.render({
-                elem: '#datetime',
+                elem: '#duration',
                 range: true
             });
         });
     });
 
+    /**表单提交方法**/
+    function submitHandler() {
+        if ($.validate.form()) {
+            let data = $("#form-record-add").serializeArray();
+            // var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
+            // var roleIds = $.form.selectCheckeds("role");
+            // var postIds = $.form.selectSelects("post");
+            // data.push({"name": "status", "value": status});
+            // data.push({"name": "roleIds", "value": roleIds});
+            // data.push({"name": "postIds", "value": postIds});
+            $.operate.saveTab(apply_prefix + "/add", data);
+        }
+    }
+
+
+    /**手风琴右侧上下箭头样式变换控制**/
+    function openOrClose(dom) {
+        let name = $(dom).attr("href").substr(1);
+        if($("span[name="+name+"]").hasClass("on")){
+            $("span[name="+name+"]").removeClass("on");
+        }else{
+            $("span[name="+name+"]").eq(0).addClass("on");
+        }
+    }
+
 
     /**选择部门树**/
     function selectDeptTree() {
@@ -205,8 +206,8 @@
 
     /**step步骤条**/
     let data = {
-        data: ['开始', '政数局审批', '${deptName}审批', '完成'],
-        index: 1 //0是第一步(0~3)
+        data: ['开始', '政数局审批', deptName+'审批', '完成'],
+        index: 0 //0是第一步(0~3)
     };
     let dom = $('#luStep');
     dom.stepInit(data);