This commit is contained in:
bo.yang 2021-07-21 09:57:17 +08:00
parent 0d31a457e5
commit 1e8d7fa79b
6 changed files with 240 additions and 38 deletions

View File

@ -7,6 +7,7 @@ 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.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -14,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -121,4 +124,37 @@ public class ExpressInfoController extends BaseController
{ {
return toAjax(expressInfoService.deleteExpressInfoByIds(ids)); return toAjax(expressInfoService.deleteExpressInfoByIds(ids));
} }
@GetMapping ( "/importTemplate" )
@ResponseBody
public AjaxResult importTemplate ( ) {
ExcelUtil < ExpressInfo > util = new ExcelUtil<>(ExpressInfo.class);
return util.importTemplateExcel ( "快递查询导入模板" );
}
@PostMapping("/importData")
@ResponseBody
public TableDataInfo importData(MultipartFile file, boolean updateSupport) throws Exception
{
/*ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = ShiroUtils.getSysUser().getLoginName();
String message = userService.importUser(userList, updateSupport, operName);
return AjaxResult.success(message);*/
ExcelUtil<ExpressInfo> util= new ExcelUtil<ExpressInfo>(ExpressInfo.class);
List<ExpressInfo> expressInfoList=util.importExcel(file.getInputStream());
List<ExpressInfo> list = new ArrayList<>();
for( ExpressInfo expressInfo:expressInfoList)
{
list.add(expressInfo);
}
//String message = expressInfoList.importUser(userList, updateSupport, operName);
return getDataTable(list);
}
} }

View File

@ -16,53 +16,79 @@ public class ExpressInfo extends BaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 消息 */ /** 消息 */
@Excel(name = "消息") @Excel(name = "消息",type= Excel.Type.EXPORT)
private String message; private String message;
/** 出货单号 */
@Excel(name = "出货单号")
private String deliveryNum;
/** 快递单号 */ /** 快递单号 */
@Excel(name = "快递单号") @Excel(name = "快递单号")
private String nu; private String nu;
/** 签收状态 */ /** 签收状态 */
@Excel(name = "签收状态") @Excel(name = "签收状态",type= Excel.Type.EXPORT,readConverterExp = "0=未签收,1=已签收")
private String ischeck; private String ischeck;
/** 快递公司 */ /** 快递公司 */
@Excel(name = "快递公司") @Excel(name = "快递公司",type= Excel.Type.EXPORT,dictType = "express_company")
private String com; private String com;
/** 通信状态 */ /** 通信状态 */
@Excel(name = "通信状态") //@Excel(name = "通信状态",type= Excel.Type.EXPORT)
private String status; private String status;
/** 运单详情 */ /** 运单详情 */
@Excel(name = "运单详情") @Excel(name = "运单详情",type= Excel.Type.EXPORT)
private String data; private String data;
/** 当前状态 */ /** 当前状态 */
@Excel(name = "当前状态") @Excel(name = "当前状态",type= Excel.Type.EXPORT,dictType = "express_stats")
private String state; private String state;
/** 状态标志 */ /** 状态标志 */
@Excel(name = "状态标志") //@Excel(name = "状态标志",type= Excel.Type.EXPORT)
private String condition; private String condition;
/** 路由信息 */ /** 路由信息 */
@Excel(name = "路由信息") //@Excel(name = "路由信息",type= Excel.Type.EXPORT)
private String routeInfo; private String routeInfo;
/** 返回码 */ /** 返回码 */
@Excel(name = "返回码") //@Excel(name = "返回码",type= Excel.Type.EXPORT)
private String returnCode; private String returnCode;
/** 返回结果 */ /** 返回结果 */
@Excel(name = "返回结果") //@Excel(name = "返回结果",type= Excel.Type.EXPORT)
private String result; private String result;
/** 电话号码 */ /** 电话号码 */
@Excel(name = "电话号码") //@Excel(name = "电话号码",type= Excel.Type.EXPORT)
private String phone; private String phone;
/** 揽收时间*/
@Excel(name = "揽收时间",type= Excel.Type.EXPORT)
private String collectTime;
/** 签收时间*/
@Excel(name = "签收时间",type= Excel.Type.EXPORT)
private String singedTime;
/** 最后更新时间*/
@Excel(name = "最后更新时间",type= Excel.Type.EXPORT)
private String lastUpdateTime;
/** 查询时间*/
@Excel(name = "查询时间",type= Excel.Type.EXPORT)
private String queryTime;
/** 查询人*/
@Excel(name = "查询人",type= Excel.Type.EXPORT)
private String queryUser;
public void setMessage(String message) public void setMessage(String message)
{ {
this.message = message; this.message = message;
@ -172,21 +198,79 @@ public class ExpressInfo extends BaseEntity
return phone; return phone;
} }
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getCollectTime() {
return collectTime;
}
public void setCollectTime(String collectTime) {
this.collectTime = collectTime;
}
public String getSingedTime() {
return singedTime;
}
public void setSingedTime(String singedTime) {
this.singedTime = singedTime;
}
public String getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(String lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getQueryTime() {
return queryTime;
}
public void setQueryTime(String queryTime) {
this.queryTime = queryTime;
}
public String getQueryUser() {
return queryUser;
}
public void setQueryUser(String queryUser) {
this.queryUser = queryUser;
}
public String getDeliveryNum() {
return deliveryNum;
}
public void setDeliveryNum(String deliveryNum) {
this.deliveryNum = deliveryNum;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return "ExpressInfo{" +
.append("message", getMessage()) "message='" + message + '\'' +
.append("nu", getNu()) ", deliveryNum='" + deliveryNum + '\'' +
.append("ischeck", getIscheck()) ", nu='" + nu + '\'' +
.append("com", getCom()) ", ischeck='" + ischeck + '\'' +
.append("status", getStatus()) ", com='" + com + '\'' +
.append("data", getData()) ", status='" + status + '\'' +
.append("state", getState()) ", data='" + data + '\'' +
.append("condition", getCondition()) ", state='" + state + '\'' +
.append("routeInfo", getRouteInfo()) ", condition='" + condition + '\'' +
.append("returnCode", getReturnCode()) ", routeInfo='" + routeInfo + '\'' +
.append("result", getResult()) ", returnCode='" + returnCode + '\'' +
.append("phone", getPhone()) ", result='" + result + '\'' +
.toString(); ", phone='" + phone + '\'' +
", collectTime='" + collectTime + '\'' +
", singedTime='" + singedTime + '\'' +
", lastUpdateTime='" + lastUpdateTime + '\'' +
", queryTime='" + queryTime + '\'' +
", queryUser='" + queryUser + '\'' +
'}';
} }
} }

View File

@ -4,6 +4,8 @@ import com.ruoyi.bps.domain.ExpressInfo;
import com.ruoyi.bps.mapper.ExpressInfoMapper; import com.ruoyi.bps.mapper.ExpressInfoMapper;
import com.ruoyi.bps.service.IExpressInfoService; import com.ruoyi.bps.service.IExpressInfoService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.kuaidi100.sdk.api.AutoNum; import com.kuaidi100.sdk.api.AutoNum;
@ -109,10 +111,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
String nu=expressInfo.getNu(); //快递单号 String nu=expressInfo.getNu(); //快递单号
String com=expressInfo.getCom(); //快递公司 String com=expressInfo.getCom(); //快递公司
String phone=expressInfo.getPhone(); //寄件人电话号码 String phone=expressInfo.getPhone(); //寄件人电话号码
String deliveryNum= expressInfo.getDeliveryNum();
ExpressInfo callbackExpressInfo=new ExpressInfo(); ExpressInfo callbackExpressInfo=new ExpressInfo();
callbackExpressInfo.setNu(nu); callbackExpressInfo.setNu(nu);
callbackExpressInfo.setPhone(phone); callbackExpressInfo.setPhone(phone);
callbackExpressInfo.setDeliveryNum(deliveryNum);
//如果没有输入快递公司编号则查询快递公司编号 //如果没有输入快递公司编号则查询快递公司编号
if(StringUtils.isEmpty(com)){ if(StringUtils.isEmpty(com)){
if(AutoGetExpressCom(nu)==null){ if(AutoGetExpressCom(nu)==null){
@ -159,6 +163,24 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
return expressInfo; return expressInfo;
} }
//获取签收时间
String signedTime=null;
if(queryTrackResp.getState().equals("3")) {
signedTime=queryTrackResp.getData().get(0).getFtime();
}
//获取最后更新时间
String lastUpdateTime=queryTrackResp.getData().get(0).getFtime();
//获取揽收时间
String collectTime= queryTrackResp.getData().get(queryTrackResp.getData().size()-1).getTime();
//获取查询时间
String queryTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss");
//获取查询人登录用户
String queryUser= ShiroUtils.getLoginName();
//将快递信息中的Context转化为字符 //将快递信息中的Context转化为字符
String dataStr=""; String dataStr="";
for(QueryTrackData queryTrackData :queryTrackResp.getData()){ for(QueryTrackData queryTrackData :queryTrackResp.getData()){
@ -181,6 +203,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
callbackExpressInfo.setReturnCode(queryTrackResp.getReturnCode()); callbackExpressInfo.setReturnCode(queryTrackResp.getReturnCode());
callbackExpressInfo.setResult(queryTrackResp.isResult()?"Y":"N"); callbackExpressInfo.setResult(queryTrackResp.isResult()?"Y":"N");
callbackExpressInfo.setPhone(expressInfo.getPhone()); callbackExpressInfo.setPhone(expressInfo.getPhone());
callbackExpressInfo.setSingedTime(signedTime);
callbackExpressInfo.setCollectTime(collectTime);
callbackExpressInfo.setLastUpdateTime(lastUpdateTime);
callbackExpressInfo.setQueryTime(queryTime);
callbackExpressInfo.setQueryUser(queryUser);
callbackExpressInfo.setDeliveryNum(expressInfo.getDeliveryNum());
return callbackExpressInfo; return callbackExpressInfo;
} }

View File

@ -22,6 +22,10 @@
<label>电话号码:</label> <label>电话号码:</label>
<input type="text" name="phone"/> <input type="text" name="phone"/>
</li> </li>
<li>
<label>出货单号:</label>
<input type="text" name="deliveryNum"/>
</li>
<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-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> <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -41,6 +45,9 @@
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="bps:expressInfo:remove"> <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="bps:expressInfo:remove">
<i class="fa fa-remove"></i> 删除 <i class="fa fa-remove"></i> 删除
</a>--> </a>-->
<a class="btn btn-info" onclick="$.table.importExcel()">
<i class="fa fa-upload"></i> 导入
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="bps:expressInfo:export"> <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="bps:expressInfo:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>
@ -66,6 +73,8 @@
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
importUrl: prefix + "/importData",
importTemplateUrl: prefix + "/importTemplate",
modalName: "快递信息", modalName: "快递信息",
columns: [{ columns: [{
checkbox: false checkbox: false
@ -75,6 +84,10 @@
field: 'message', field: 'message',
title: '消息' title: '消息'
},*/ },*/
{
field: 'deliveryNum',
title: '出货单号'
},
{ {
field: 'nu', field: 'nu',
title: '快递单号' title: '快递单号'
@ -126,10 +139,32 @@
field: 'result', field: 'result',
title: '返回结果' title: '返回结果'
},*/ },*/
{ {
field: 'phone', field: 'phone',
title: '电话号码' title: '电话号码'
}/*, },
{
field: 'singedTime',
title: '签收时间'
},
{
field: 'collectTime',
title: '揽收时间'
},
{
field: 'lastUpdateTime',
title: '最后更新时间'
},
{
field: 'queryTime',
title: '查询时间'
},
{
field: 'queryUser',
title: '查询人'
}
/*
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
@ -144,5 +179,19 @@
$.table.init(options); $.table.init(options);
}); });
</script> </script>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
<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">
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
</div>
<span class="pull-left mt10" style="color: red; ">
提示仅允许导入“xls”或“xlsx”格式文件
</span>
</div>
</form>
</script>
</body> </body>
</html> </html>

View File

@ -1,7 +1,7 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.google.gson.Gson; import com.alibaba.fastjson.JSON;
import com.google.gson.reflect.TypeToken; import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
@ -19,7 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/** /**
* 部门管理 服务实现 * 部门管理 服务实现
@ -330,13 +333,13 @@ public class SysDeptServiceImpl implements ISysDeptService
} }
//取Ecology返回信息中的部门信息 //取Ecology返回信息中的部门信息
/*Map<String,Object> mapTest = (Map) JSON.parse(mapResult.get("result")); Map<String,Object> map = (Map) JSON.parse(mapResult.get("result"));
Map<String,Object> dataMap= (Map<String, Object>) map.get("data"); Map<String,Object> dataMap= (Map<String, Object>) map.get("data");
JSONArray json = (JSONArray) o.get("dataList"); JSONArray json = (JSONArray) dataMap.get("dataList");
List<EcologyDept> deptList = JSONArray.parseArray(json.toJSONString(), EcologyDept.class);*/ List<EcologyDept> deptList = JSONArray.parseArray(json.toJSONString(), EcologyDept.class);
Map<String,Object> map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class); /*Map<String,Object> map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class);
Map<String,Object> dataMap= new Gson().fromJson(new Gson().toJson(map.get("data")),HashMap.class); Map<String,Object> dataMap= new Gson().fromJson(new Gson().toJson(map.get("data")),HashMap.class);
List<EcologyDept> deptList= new Gson().fromJson(new Gson().toJson(dataMap.get("dataList")), new TypeToken<List<EcologyDept>>(){}.getType()); List<EcologyDept> deptList= new Gson().fromJson(new Gson().toJson(dataMap.get("dataList")), new TypeToken<List<EcologyDept>>(){}.getType());*/
//清空部门表 //清空部门表
deptMapper.truncateDept(); deptMapper.truncateDept();

View File

@ -1,5 +1,7 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataScope;
@ -547,14 +549,14 @@ public class SysUserServiceImpl implements ISysUserService
} }
//取Ecology返回信息中的部门信息 //取Ecology返回信息中的部门信息
/*Map<String,Object> map = (Map) JSON.parse(mapResult.get("result")); Map<String,Object> map = (Map) JSON.parse(mapResult.get("result"));
Map<String,Object> dataMap= (Map<String, Object>) map.get("data"); Map<String,Object> dataMap= (Map<String, Object>) map.get("data");
JSONArray json = (JSONArray) dataMap.get("dataList"); JSONArray json = (JSONArray) dataMap.get("dataList");
List<EcologyUser> ecologyUserList = JSONArray.parseArray(json.toJSONString(), EcologyUser.class);*/ List<EcologyUser> ecologyUserList = JSONArray.parseArray(json.toJSONString(), EcologyUser.class);
Map<String,Object> map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class); /*Map<String,Object> map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class);
Map<String,Object> dataMap= new Gson().fromJson(new Gson().toJson(map.get("data")),HashMap.class); Map<String,Object> dataMap= new Gson().fromJson(new Gson().toJson(map.get("data")),HashMap.class);
List<EcologyUser> ecologyUserList= new Gson().fromJson(dataMap.get("dataList").toString(), new TypeToken<List<EcologyUser>>(){}.getType()); List<EcologyUser> ecologyUserList= new Gson().fromJson(dataMap.get("dataList").toString(), new TypeToken<List<EcologyUser>>(){}.getType());
*/
//删除从Ecology同步过来用户类型为02的用户 //删除从Ecology同步过来用户类型为02的用户
userMapper.deleteEcologySyncUser(); userMapper.deleteEcologySyncUser();