1、提升Excel批量查询结果插入数据表expressInfo的效率
2、expressInfo增加自增长ID,sid
This commit is contained in:
parent
b54814fc40
commit
bbdd968254
|
|
@ -15,6 +15,9 @@ public class ExpressInfo extends BaseEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 消息 */
|
||||
private String sid;
|
||||
|
||||
/** 消息 */
|
||||
@Excel(name = "消息",type= Excel.Type.EXPORT)
|
||||
private String message;
|
||||
|
|
@ -98,6 +101,14 @@ public class ExpressInfo extends BaseEntity
|
|||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
|
@ -261,7 +272,8 @@ public class ExpressInfo extends BaseEntity
|
|||
@Override
|
||||
public String toString() {
|
||||
return "ExpressInfo{" +
|
||||
"message='" + message + '\'' +
|
||||
"sid='" + sid + '\'' +
|
||||
", message='" + message + '\'' +
|
||||
", deliveryNum='" + deliveryNum + '\'' +
|
||||
", nu='" + nu + '\'' +
|
||||
", ischeck='" + ischeck + '\'' +
|
||||
|
|
|
|||
|
|
@ -61,4 +61,12 @@ public interface ExpressInfoMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteExpressInfoByIds(String[] messages);
|
||||
|
||||
/**
|
||||
* 批量新增快递信息
|
||||
*
|
||||
* @param expressInfoList 角色菜单列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertExpressInfo(List<ExpressInfo> expressInfoList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.bps.service.impl;
|
|||
import com.ruoyi.bps.domain.ExpImportQuery;
|
||||
import com.ruoyi.bps.domain.ExpressInfo;
|
||||
import com.ruoyi.bps.mapper.ExpImportQueryMapper;
|
||||
import com.ruoyi.bps.mapper.ExpressInfoMapper;
|
||||
import com.ruoyi.bps.service.IExpImportQueryService;
|
||||
import com.ruoyi.bps.service.IExpressInfoService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
|
@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +32,9 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
|
|||
@Autowired
|
||||
private IExpressInfoService expressInfoService;
|
||||
|
||||
@Autowired
|
||||
private ExpressInfoMapper expressInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询Excel批量快递查询
|
||||
*
|
||||
|
|
@ -114,16 +119,20 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
|
|||
String queryTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss");
|
||||
String queryId= LocalDateTime.now().toString();
|
||||
ExpImportQuery expImportQuery=new ExpImportQuery();
|
||||
List<ExpressInfo> expressInfoListForInsert=new ArrayList<>();
|
||||
try{
|
||||
//将查询到的快递结果放到expressInfoListForInsert,并插入到数据库表expressInfo
|
||||
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);
|
||||
//expressInfoService.insertExpressInfo(ei);
|
||||
expressInfoListForInsert.add(ei);
|
||||
}
|
||||
|
||||
expressInfoMapper.batchInsertExpressInfo(expressInfoListForInsert);
|
||||
//将本次excel导入查询记录到数据表exp_import_query
|
||||
expImportQuery.setQueryTime(queryTime);
|
||||
expImportQuery.setQueryLoginName(ShiroUtils.getLoginName());
|
||||
expImportQuery.setQueryUserName(ShiroUtils.getSysUser().getUserName());
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.ruoyi.bps.mapper.ExpressInfoMapper">
|
||||
|
||||
<resultMap type="ExpressInfo" id="ExpressInfoResult">
|
||||
<result property="sid" column="sid" />
|
||||
<result property="message" column="message" />
|
||||
<result property="nu" column="nu" />
|
||||
<result property="ischeck" column="ischeck" />
|
||||
|
|
@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectExpressInfoVo">
|
||||
select message, nu, deliveryNum, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
|
||||
select sid, message, nu, deliveryNum, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
|
||||
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType
|
||||
from expressInfo
|
||||
</sql>
|
||||
|
|
@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectExpressInfoById" parameterType="String" resultMap="ExpressInfoResult">
|
||||
<include refid="selectExpressInfoVo"/>
|
||||
where message = #{message}
|
||||
where sid = #{sid}
|
||||
</select>
|
||||
|
||||
<insert id="insertExpressInfo" parameterType="ExpressInfo">
|
||||
|
|
@ -125,14 +126,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteExpressInfoById" parameterType="String">
|
||||
delete from expressInfo where message = #{message}
|
||||
delete from expressInfo where sid = #{sid}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteExpressInfoByIds" parameterType="String">
|
||||
delete from expressInfo where message in
|
||||
<foreach item="message" collection="array" open="(" separator="," close=")">
|
||||
#{message}
|
||||
#{sid}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertExpressInfo">
|
||||
insert into expressInfo(message, nu, deliveryNum, ischeck, com, status, `data`, `state`, `condition`, routeInfo, returnCode, `result`, phone,
|
||||
collectTime, singedTime, lastUpdateTime, queryTime, queryUserName, queryId, queryType) values
|
||||
<foreach item="expressInfo" index="index" collection="list" separator=",">
|
||||
( #{expressInfo.message}, #{expressInfo.nu}, #{expressInfo.deliveryNum}, #{expressInfo.ischeck}, #{expressInfo.com}, #{expressInfo.status},
|
||||
#{expressInfo.data}, #{expressInfo.state}, #{expressInfo.condition}, #{expressInfo.routeInfo}, #{expressInfo.returnCode},
|
||||
#{expressInfo.result}, #{expressInfo.phone}, #{expressInfo.collectTime}, #{expressInfo.singedTime}, #{expressInfo.lastUpdateTime},
|
||||
#{expressInfo.queryTime}, #{expressInfo.queryUserName}, #{expressInfo.queryId}, #{expressInfo.queryType}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -78,11 +78,17 @@
|
|||
modalName: "快递信息",
|
||||
columns: [{
|
||||
checkbox: false
|
||||
},
|
||||
{
|
||||
field: 'sid',
|
||||
title: 'SID',
|
||||
visible: false
|
||||
},
|
||||
/*
|
||||
{
|
||||
field: 'message',
|
||||
title: '消息'
|
||||
title: '消息',
|
||||
visible: false
|
||||
},*/
|
||||
{
|
||||
field: 'deliveryNum',
|
||||
|
|
@ -95,7 +101,8 @@
|
|||
/*
|
||||
{
|
||||
field: 'ischeck',
|
||||
title: '签收状态'
|
||||
title: '签收状态',
|
||||
visible: false
|
||||
},*/
|
||||
{
|
||||
field: 'com',
|
||||
|
|
@ -107,7 +114,8 @@
|
|||
/*
|
||||
{
|
||||
field: 'status',
|
||||
title: '通信状态'
|
||||
title: '通信状态',
|
||||
visible: false
|
||||
},*/
|
||||
{
|
||||
field: 'data',
|
||||
|
|
@ -125,19 +133,23 @@
|
|||
},/*
|
||||
{
|
||||
field: 'condition',
|
||||
title: '状态标志'
|
||||
title: '状态标志',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'routeInfo',
|
||||
title: '路由信息'
|
||||
title: '路由信息',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'returnCode',
|
||||
title: '返回码'
|
||||
title: '返回码',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'result',
|
||||
title: '返回结果'
|
||||
title: '返回结果',
|
||||
visible: false
|
||||
},*/
|
||||
|
||||
{
|
||||
|
|
@ -170,8 +182,8 @@
|
|||
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.message + '\')"><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.message + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sid + '\')"><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.sid + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}*/]
|
||||
|
|
|
|||
Loading…
Reference in New Issue