优化快递查询、Excel批量查询
This commit is contained in:
parent
492b3618c6
commit
b54814fc40
|
|
@ -10,8 +10,6 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -20,7 +18,6 @@ import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -164,8 +161,9 @@ public class ExpImportQueryController extends BaseController
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel导入查模板下载
|
||||||
|
*/
|
||||||
@GetMapping ( "/importTemplate" )
|
@GetMapping ( "/importTemplate" )
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importTemplate ( ) {
|
public AjaxResult importTemplate ( ) {
|
||||||
|
|
@ -173,40 +171,16 @@ public class ExpImportQueryController extends BaseController
|
||||||
return util.importTemplateExcel ( "快递查询导入模板" );
|
return util.importTemplateExcel ( "快递查询导入模板" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel导入查询
|
||||||
|
*/
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
|
@Log(title = "Excel批量导入快递查询", businessType = BusinessType.IMPORT)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
{
|
{
|
||||||
String queryTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss");
|
|
||||||
String queryId= LocalDateTime.now().toString();
|
|
||||||
ExcelUtil<ExpressInfo> util= new ExcelUtil<ExpressInfo>(ExpressInfo.class);
|
ExcelUtil<ExpressInfo> util= new ExcelUtil<ExpressInfo>(ExpressInfo.class);
|
||||||
List<ExpressInfo> expressInfoList=util.importExcel(file.getInputStream());
|
List<ExpressInfo> expressInfoList=util.importExcel(file.getInputStream());
|
||||||
ExpImportQuery expImportQuery=new ExpImportQuery();
|
return expImportQueryService.importData(expressInfoList);
|
||||||
try{
|
|
||||||
for( ExpressInfo expressInfo:expressInfoList){
|
|
||||||
ExpressInfo ei= expressInfoService.SelectExpressInfo(expressInfo);
|
|
||||||
ei.setQueryId(queryId);
|
|
||||||
ei.setQueryUserName(ShiroUtils.getSysUser().getUserName());
|
|
||||||
ei.setQueryType("excel");
|
|
||||||
ei.setQueryTime(queryTime);
|
|
||||||
expressInfoService.insertExpressInfo(ei);
|
|
||||||
}
|
|
||||||
|
|
||||||
expImportQuery.setQueryTime(queryTime);
|
|
||||||
expImportQuery.setQueryLoginName(ShiroUtils.getLoginName());
|
|
||||||
expImportQuery.setQueryUserName(ShiroUtils.getSysUser().getUserName());
|
|
||||||
expImportQuery.setFinishTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
expImportQuery.setQueryIp(ShiroUtils.getIp());
|
|
||||||
expImportQuery.setStatus("success");
|
|
||||||
expImportQuery.setQueryQty(String.valueOf(expressInfoList.size()));
|
|
||||||
expImportQuery.setQueryId(queryId);
|
|
||||||
expImportQueryService.insertExpImportQuery(expImportQuery);
|
|
||||||
|
|
||||||
return AjaxResult.success("导入查询成功!");
|
|
||||||
}catch (Exception e){
|
|
||||||
expImportQuery.setStatus("fail");
|
|
||||||
return AjaxResult.error(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.bps.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.bps.domain.ExpImportQuery;
|
import com.ruoyi.bps.domain.ExpImportQuery;
|
||||||
|
import com.ruoyi.bps.domain.ExpressInfo;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel批量快递查询Service接口
|
* Excel批量快递查询Service接口
|
||||||
|
|
@ -58,4 +60,13 @@ public interface IExpImportQueryService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteExpImportQueryById(Long sid);
|
public int deleteExpImportQueryById(Long sid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除Excel批量快递查询信息
|
||||||
|
*
|
||||||
|
* @param expressInfoList Excel导入的快递列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public AjaxResult importData(List<ExpressInfo> expressInfoList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
package com.ruoyi.bps.service.impl;
|
package com.ruoyi.bps.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import com.ruoyi.bps.domain.ExpImportQuery;
|
||||||
|
import com.ruoyi.bps.domain.ExpressInfo;
|
||||||
|
import com.ruoyi.bps.mapper.ExpImportQueryMapper;
|
||||||
|
import com.ruoyi.bps.service.IExpImportQueryService;
|
||||||
|
import com.ruoyi.bps.service.IExpressInfoService;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.bps.mapper.ExpImportQueryMapper;
|
|
||||||
import com.ruoyi.bps.domain.ExpImportQuery;
|
import java.time.LocalDateTime;
|
||||||
import com.ruoyi.bps.service.IExpImportQueryService;
|
import java.util.List;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel批量快递查询Service业务层处理
|
* Excel批量快递查询Service业务层处理
|
||||||
|
|
@ -20,6 +27,9 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
|
||||||
@Autowired
|
@Autowired
|
||||||
private ExpImportQueryMapper expImportQueryMapper;
|
private ExpImportQueryMapper expImportQueryMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExpressInfoService expressInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询Excel批量快递查询
|
* 查询Excel批量快递查询
|
||||||
*
|
*
|
||||||
|
|
@ -91,4 +101,43 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
|
||||||
{
|
{
|
||||||
return expImportQueryMapper.deleteExpImportQueryById(sid);
|
return expImportQueryMapper.deleteExpImportQueryById(sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除Excel批量快递查询信息
|
||||||
|
*
|
||||||
|
* @param expressInfoList Excel导入的快递列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult importData(List<ExpressInfo> expressInfoList) {
|
||||||
|
String queryTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String queryId= LocalDateTime.now().toString();
|
||||||
|
ExpImportQuery expImportQuery=new ExpImportQuery();
|
||||||
|
try{
|
||||||
|
for( ExpressInfo expressInfo:expressInfoList){
|
||||||
|
ExpressInfo ei= expressInfoService.SelectExpressInfo(expressInfo);
|
||||||
|
ei.setQueryId(queryId);
|
||||||
|
ei.setQueryUserName(ShiroUtils.getSysUser().getUserName());
|
||||||
|
ei.setQueryType("excel");
|
||||||
|
ei.setQueryTime(queryTime);
|
||||||
|
expressInfoService.insertExpressInfo(ei);
|
||||||
|
}
|
||||||
|
|
||||||
|
expImportQuery.setQueryTime(queryTime);
|
||||||
|
expImportQuery.setQueryLoginName(ShiroUtils.getLoginName());
|
||||||
|
expImportQuery.setQueryUserName(ShiroUtils.getSysUser().getUserName());
|
||||||
|
expImportQuery.setFinishTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
expImportQuery.setQueryIp(ShiroUtils.getIp());
|
||||||
|
expImportQuery.setStatus("success");
|
||||||
|
expImportQuery.setQueryQty(String.valueOf(expressInfoList.size()));
|
||||||
|
expImportQuery.setQueryId(queryId);
|
||||||
|
expImportQueryMapper.insertExpImportQuery(expImportQuery);
|
||||||
|
|
||||||
|
return AjaxResult.success("导入查询成功!");
|
||||||
|
}catch (Exception e){
|
||||||
|
expImportQuery.setStatus("fail");
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="queryUserName" column="queryUserName" />
|
<result property="queryUserName" column="queryUserName" />
|
||||||
<result property="queryId" column="queryId" />
|
<result property="queryId" column="queryId" />
|
||||||
<result property="queryType" column="queryType" />
|
<result property="queryType" column="queryType" />
|
||||||
|
<result property="deliveryNum" column="deliveryNum" />
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectExpressInfoVo">
|
<sql id="selectExpressInfoVo">
|
||||||
select message, nu, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
|
select message, nu, deliveryNum, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
|
||||||
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType
|
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType
|
||||||
from expressInfo
|
from expressInfo
|
||||||
</sql>
|
</sql>
|
||||||
|
|
@ -39,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="com != null and com != ''"> and com = #{com}</if>
|
<if test="com != null and com != ''"> and com = #{com}</if>
|
||||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||||
<if test="queryId != null and queryId != ''"> and queryId = #{queryId}</if>
|
<if test="queryId != null and queryId != ''"> and queryId = #{queryId}</if>
|
||||||
|
<if test="deliveryNum != null and deliveryNum != ''"> and deliveryNum = #{deliveryNum}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -69,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="queryUserName != null">queryUserName,</if>
|
<if test="queryUserName != null">queryUserName,</if>
|
||||||
<if test="queryId != null">queryId,</if>
|
<if test="queryId != null">queryId,</if>
|
||||||
<if test="queryType != null">queryType,</if>
|
<if test="queryType != null">queryType,</if>
|
||||||
|
<if test="deliveryNum != null">deliveryNum,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="message != null">#{message},</if>
|
<if test="message != null">#{message},</if>
|
||||||
|
|
@ -90,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="queryUserName != null">#{queryUserName},</if>
|
<if test="queryUserName != null">#{queryUserName},</if>
|
||||||
<if test="queryId != null">#{queryId},</if>
|
<if test="queryId != null">#{queryId},</if>
|
||||||
<if test="queryType != null">#{queryType},</if>
|
<if test="queryType != null">#{queryType},</if>
|
||||||
|
<if test="deliveryNum != null">#{deliveryNum},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
@ -114,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="queryUserName != null">queryUserName = #{queryUserName},</if>
|
<if test="queryUserName != null">queryUserName = #{queryUserName},</if>
|
||||||
<if test="queryId != null">queryId = #{queryId},</if>
|
<if test="queryId != null">queryId = #{queryId},</if>
|
||||||
<if test="queryType != null">queryType = #{queryType},</if>
|
<if test="queryType != null">queryType = #{queryType},</if>
|
||||||
|
<if test="deliveryNum != null">deliveryNum = #{deliveryNum},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where message = #{message}
|
where message = #{message}
|
||||||
</update>
|
</update>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-expImportQuery-add">
|
<form class="form-horizontal m" id="form-expImportQuery-add">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">查询ID:</label>
|
<label class="col-sm-3 control-label">查询编号:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="queryId" class="form-control" type="text">
|
<input name="queryId" class="form-control" type="text">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
<div class="select-list">
|
<div class="select-list">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label>查询ID:</label>
|
<label>查询编号:</label>
|
||||||
<input type="text" name="queryId" th:field="*{queryId}"/>
|
<input type="text" name="queryId" th:field="*{queryId}" readonly/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@
|
||||||
<a class="btn btn-info" onclick="$.table.importExcel()">
|
<a class="btn btn-info" onclick="$.table.importExcel()">
|
||||||
<i class="fa fa-upload"></i> 导入
|
<i class="fa fa-upload"></i> 导入
|
||||||
</a>
|
</a>
|
||||||
|
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs">
|
||||||
|
<i class="fa fa-file-excel-o"></i> 下载导入模板
|
||||||
|
</a>
|
||||||
<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="bps:expImportQuery:add">
|
<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="bps:expImportQuery:add">
|
||||||
<i class="fa fa-plus"></i> 添加
|
<i class="fa fa-plus"></i> 添加
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -78,6 +81,8 @@
|
||||||
exportUrl: prefix + "/export",
|
exportUrl: prefix + "/export",
|
||||||
importUrl: prefix + "/importData",
|
importUrl: prefix + "/importData",
|
||||||
importTemplateUrl: prefix + "/importTemplate",
|
importTemplateUrl: prefix + "/importTemplate",
|
||||||
|
sortName: "querytime",
|
||||||
|
sortOrder: "desc",
|
||||||
modalName: "Excel批量快递查询",
|
modalName: "Excel批量快递查询",
|
||||||
columns: [{
|
columns: [{
|
||||||
checkbox: true
|
checkbox: true
|
||||||
|
|
@ -89,7 +94,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'queryId',
|
field: 'queryId',
|
||||||
title: '查询ID'
|
title: '查询编号'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'queryTime',
|
field: 'queryTime',
|
||||||
|
|
@ -143,9 +148,9 @@
|
||||||
<form enctype="multipart/form-data" class="mt20 mb10">
|
<form enctype="multipart/form-data" class="mt20 mb10">
|
||||||
<div class="col-xs-offset-1">
|
<div class="col-xs-offset-1">
|
||||||
<input type="file" id="file" name="file"/>
|
<input type="file" id="file" name="file"/>
|
||||||
<div class="mt10 pt5">
|
<!--<div class="mt10 pt5">
|
||||||
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
|
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
|
||||||
</div>
|
</div>-->
|
||||||
<span class="pull-left mt10" style="color: red; ">
|
<span class="pull-left mt10" style="color: red; ">
|
||||||
提示:仅允许导入“xls”或“xlsx”格式文件!
|
提示:仅允许导入“xls”或“xlsx”格式文件!
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<input type="text" name="deliveryNum"/>
|
<input type="text" name="deliveryNum"/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>实时查询</a>
|
||||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue