优化快递查询、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.page.TableDataInfo;
|
||||
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 org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -164,8 +161,9 @@ public class ExpImportQueryController extends BaseController
|
|||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Excel导入查模板下载
|
||||
*/
|
||||
@GetMapping ( "/importTemplate" )
|
||||
@ResponseBody
|
||||
public AjaxResult importTemplate ( ) {
|
||||
|
|
@ -173,40 +171,16 @@ public class ExpImportQueryController extends BaseController
|
|||
return util.importTemplateExcel ( "快递查询导入模板" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导入查询
|
||||
*/
|
||||
@PostMapping("/importData")
|
||||
@Log(title = "Excel批量导入快递查询", businessType = BusinessType.IMPORT)
|
||||
@ResponseBody
|
||||
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);
|
||||
List<ExpressInfo> expressInfoList=util.importExcel(file.getInputStream());
|
||||
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);
|
||||
expImportQueryService.insertExpImportQuery(expImportQuery);
|
||||
|
||||
return AjaxResult.success("导入查询成功!");
|
||||
}catch (Exception e){
|
||||
expImportQuery.setStatus("fail");
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
return expImportQueryService.importData(expressInfoList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.bps.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.ruoyi.bps.domain.ExpImportQuery;
|
||||
import com.ruoyi.bps.domain.ExpressInfo;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* Excel批量快递查询Service接口
|
||||
|
|
@ -58,4 +60,13 @@ public interface IExpImportQueryService
|
|||
* @return 结果
|
||||
*/
|
||||
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;
|
||||
|
||||
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.stereotype.Service;
|
||||
import com.ruoyi.bps.mapper.ExpImportQueryMapper;
|
||||
import com.ruoyi.bps.domain.ExpImportQuery;
|
||||
import com.ruoyi.bps.service.IExpImportQueryService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Excel批量快递查询Service业务层处理
|
||||
|
|
@ -20,6 +27,9 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
|
|||
@Autowired
|
||||
private ExpImportQueryMapper expImportQueryMapper;
|
||||
|
||||
@Autowired
|
||||
private IExpressInfoService expressInfoService;
|
||||
|
||||
/**
|
||||
* 查询Excel批量快递查询
|
||||
*
|
||||
|
|
@ -91,4 +101,43 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
|
|||
{
|
||||
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="queryId" column="queryId" />
|
||||
<result property="queryType" column="queryType" />
|
||||
<result property="deliveryNum" column="deliveryNum" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<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
|
||||
from expressInfo
|
||||
</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="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
<if test="queryId != null and queryId != ''"> and queryId = #{queryId}</if>
|
||||
<if test="deliveryNum != null and deliveryNum != ''"> and deliveryNum = #{deliveryNum}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -69,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="queryUserName != null">queryUserName,</if>
|
||||
<if test="queryId != null">queryId,</if>
|
||||
<if test="queryType != null">queryType,</if>
|
||||
<if test="deliveryNum != null">deliveryNum,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<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="queryId != null">#{queryId},</if>
|
||||
<if test="queryType != null">#{queryType},</if>
|
||||
<if test="deliveryNum != null">#{deliveryNum},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -114,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="queryUserName != null">queryUserName = #{queryUserName},</if>
|
||||
<if test="queryId != null">queryId = #{queryId},</if>
|
||||
<if test="queryType != null">queryType = #{queryType},</if>
|
||||
<if test="deliveryNum != null">deliveryNum = #{deliveryNum},</if>
|
||||
</trim>
|
||||
where message = #{message}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-expImportQuery-add">
|
||||
<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">
|
||||
<input name="queryId" class="form-control" type="text">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>查询ID:</label>
|
||||
<input type="text" name="queryId" th:field="*{queryId}"/>
|
||||
<label>查询编号:</label>
|
||||
<input type="text" name="queryId" th:field="*{queryId}" readonly/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@
|
|||
<a class="btn btn-info" onclick="$.table.importExcel()">
|
||||
<i class="fa fa-upload"></i> 导入
|
||||
</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">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
|
|
@ -78,6 +81,8 @@
|
|||
exportUrl: prefix + "/export",
|
||||
importUrl: prefix + "/importData",
|
||||
importTemplateUrl: prefix + "/importTemplate",
|
||||
sortName: "querytime",
|
||||
sortOrder: "desc",
|
||||
modalName: "Excel批量快递查询",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
|
|
@ -89,7 +94,7 @@
|
|||
},
|
||||
{
|
||||
field: 'queryId',
|
||||
title: '查询ID'
|
||||
title: '查询编号'
|
||||
},
|
||||
{
|
||||
field: 'queryTime',
|
||||
|
|
@ -143,9 +148,9 @@
|
|||
<form enctype="multipart/form-data" class="mt20 mb10">
|
||||
<div class="col-xs-offset-1">
|
||||
<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>
|
||||
</div>
|
||||
</div>-->
|
||||
<span class="pull-left mt10" style="color: red; ">
|
||||
提示:仅允许导入“xls”或“xlsx”格式文件!
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<input type="text" name="deliveryNum"/>
|
||||
</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>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Reference in New Issue