From 1e8d7fa79b98b3cdff642eb6e0d349d8504600fd Mon Sep 17 00:00:00 2001 From: "bo.yang" Date: Wed, 21 Jul 2021 09:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bps/controller/ExpressInfoController.java | 36 +++++ .../com/ruoyi/bps/domain/ExpressInfo.java | 134 ++++++++++++++---- .../service/impl/ExpressInfoServiceImpl.java | 28 ++++ .../bps/expressInfo/expressInfo.html | 51 ++++++- .../service/impl/SysDeptServiceImpl.java | 19 +-- .../service/impl/SysUserServiceImpl.java | 10 +- 6 files changed, 240 insertions(+), 38 deletions(-) diff --git a/box-bps/src/main/java/com/ruoyi/bps/controller/ExpressInfoController.java b/box-bps/src/main/java/com/ruoyi/bps/controller/ExpressInfoController.java index ae09c6b0b..fc2474be1 100644 --- a/box-bps/src/main/java/com/ruoyi/bps/controller/ExpressInfoController.java +++ b/box-bps/src/main/java/com/ruoyi/bps/controller/ExpressInfoController.java @@ -7,6 +7,7 @@ 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.ShiroUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.controller.BaseController; 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.ui.ModelMap; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import java.util.ArrayList; import java.util.List; /** @@ -121,4 +124,37 @@ public class ExpressInfoController extends BaseController { 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 util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + String operName = ShiroUtils.getSysUser().getLoginName(); + String message = userService.importUser(userList, updateSupport, operName); + return AjaxResult.success(message);*/ + + ExcelUtil util= new ExcelUtil(ExpressInfo.class); + List expressInfoList=util.importExcel(file.getInputStream()); + List list = new ArrayList<>(); + for( ExpressInfo expressInfo:expressInfoList) + { + list.add(expressInfo); + + } + + //String message = expressInfoList.importUser(userList, updateSupport, operName); + + return getDataTable(list); + } } diff --git a/box-bps/src/main/java/com/ruoyi/bps/domain/ExpressInfo.java b/box-bps/src/main/java/com/ruoyi/bps/domain/ExpressInfo.java index 72b2d967e..e34dd86b6 100644 --- a/box-bps/src/main/java/com/ruoyi/bps/domain/ExpressInfo.java +++ b/box-bps/src/main/java/com/ruoyi/bps/domain/ExpressInfo.java @@ -16,53 +16,79 @@ public class ExpressInfo extends BaseEntity private static final long serialVersionUID = 1L; /** 消息 */ - @Excel(name = "消息") + @Excel(name = "消息",type= Excel.Type.EXPORT) private String message; + + /** 出货单号 */ + @Excel(name = "出货单号") + private String deliveryNum; + /** 快递单号 */ @Excel(name = "快递单号") private String nu; /** 签收状态 */ - @Excel(name = "签收状态") + @Excel(name = "签收状态",type= Excel.Type.EXPORT,readConverterExp = "0=未签收,1=已签收") private String ischeck; /** 快递公司 */ - @Excel(name = "快递公司") + @Excel(name = "快递公司",type= Excel.Type.EXPORT,dictType = "express_company") private String com; /** 通信状态 */ - @Excel(name = "通信状态") + //@Excel(name = "通信状态",type= Excel.Type.EXPORT) private String status; /** 运单详情 */ - @Excel(name = "运单详情") + @Excel(name = "运单详情",type= Excel.Type.EXPORT) private String data; /** 当前状态 */ - @Excel(name = "当前状态") + @Excel(name = "当前状态",type= Excel.Type.EXPORT,dictType = "express_stats") private String state; /** 状态标志 */ - @Excel(name = "状态标志") + //@Excel(name = "状态标志",type= Excel.Type.EXPORT) private String condition; /** 路由信息 */ - @Excel(name = "路由信息") + //@Excel(name = "路由信息",type= Excel.Type.EXPORT) private String routeInfo; /** 返回码 */ - @Excel(name = "返回码") + //@Excel(name = "返回码",type= Excel.Type.EXPORT) private String returnCode; /** 返回结果 */ - @Excel(name = "返回结果") + //@Excel(name = "返回结果",type= Excel.Type.EXPORT) private String result; /** 电话号码 */ - @Excel(name = "电话号码") + //@Excel(name = "电话号码",type= Excel.Type.EXPORT) 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) { this.message = message; @@ -172,21 +198,79 @@ public class ExpressInfo extends BaseEntity 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 public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("message", getMessage()) - .append("nu", getNu()) - .append("ischeck", getIscheck()) - .append("com", getCom()) - .append("status", getStatus()) - .append("data", getData()) - .append("state", getState()) - .append("condition", getCondition()) - .append("routeInfo", getRouteInfo()) - .append("returnCode", getReturnCode()) - .append("result", getResult()) - .append("phone", getPhone()) - .toString(); + return "ExpressInfo{" + + "message='" + message + '\'' + + ", deliveryNum='" + deliveryNum + '\'' + + ", nu='" + nu + '\'' + + ", ischeck='" + ischeck + '\'' + + ", com='" + com + '\'' + + ", status='" + status + '\'' + + ", data='" + data + '\'' + + ", state='" + state + '\'' + + ", condition='" + condition + '\'' + + ", routeInfo='" + routeInfo + '\'' + + ", returnCode='" + returnCode + '\'' + + ", result='" + result + '\'' + + ", phone='" + phone + '\'' + + ", collectTime='" + collectTime + '\'' + + ", singedTime='" + singedTime + '\'' + + ", lastUpdateTime='" + lastUpdateTime + '\'' + + ", queryTime='" + queryTime + '\'' + + ", queryUser='" + queryUser + '\'' + + '}'; } } diff --git a/box-bps/src/main/java/com/ruoyi/bps/service/impl/ExpressInfoServiceImpl.java b/box-bps/src/main/java/com/ruoyi/bps/service/impl/ExpressInfoServiceImpl.java index 8786681d9..fcec56e11 100644 --- a/box-bps/src/main/java/com/ruoyi/bps/service/impl/ExpressInfoServiceImpl.java +++ b/box-bps/src/main/java/com/ruoyi/bps/service/impl/ExpressInfoServiceImpl.java @@ -4,6 +4,8 @@ import com.ruoyi.bps.domain.ExpressInfo; import com.ruoyi.bps.mapper.ExpressInfoMapper; import com.ruoyi.bps.service.IExpressInfoService; 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.google.gson.Gson; import com.kuaidi100.sdk.api.AutoNum; @@ -109,10 +111,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService String nu=expressInfo.getNu(); //快递单号 String com=expressInfo.getCom(); //快递公司 String phone=expressInfo.getPhone(); //收、寄件人电话号码 + String deliveryNum= expressInfo.getDeliveryNum(); ExpressInfo callbackExpressInfo=new ExpressInfo(); callbackExpressInfo.setNu(nu); callbackExpressInfo.setPhone(phone); + callbackExpressInfo.setDeliveryNum(deliveryNum); //如果没有输入快递公司编号,则查询快递公司编号 if(StringUtils.isEmpty(com)){ if(AutoGetExpressCom(nu)==null){ @@ -159,6 +163,24 @@ public class ExpressInfoServiceImpl implements IExpressInfoService 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转化为字符 String dataStr=""; for(QueryTrackData queryTrackData :queryTrackResp.getData()){ @@ -181,6 +203,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService callbackExpressInfo.setReturnCode(queryTrackResp.getReturnCode()); callbackExpressInfo.setResult(queryTrackResp.isResult()?"Y":"N"); 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; } diff --git a/box-bps/src/main/resources/templates/bps/expressInfo/expressInfo.html b/box-bps/src/main/resources/templates/bps/expressInfo/expressInfo.html index 10189c314..5cb02ff5c 100644 --- a/box-bps/src/main/resources/templates/bps/expressInfo/expressInfo.html +++ b/box-bps/src/main/resources/templates/bps/expressInfo/expressInfo.html @@ -22,6 +22,10 @@ +
  • + + +
  •  搜索  重置 @@ -41,6 +45,9 @@ 删除 --> + + 导入 + 导出 @@ -66,6 +73,8 @@ updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", exportUrl: prefix + "/export", + importUrl: prefix + "/importData", + importTemplateUrl: prefix + "/importTemplate", modalName: "快递信息", columns: [{ checkbox: false @@ -75,6 +84,10 @@ field: 'message', title: '消息' },*/ + { + field: 'deliveryNum', + title: '出货单号' + }, { field: 'nu', title: '快递单号' @@ -126,10 +139,32 @@ field: 'result', title: '返回结果' },*/ + { field: 'phone', title: '电话号码' - }/*, + }, + { + field: 'singedTime', + title: '签收时间' + }, + { + field: 'collectTime', + title: '揽收时间' + }, + { + field: 'lastUpdateTime', + title: '最后更新时间' + }, + { + field: 'queryTime', + title: '查询时间' + }, + { + field: 'queryUser', + title: '查询人' + } + /* { title: '操作', align: 'center', @@ -144,5 +179,19 @@ $.table.init(options); }); + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index e8cebe16e..d665df5df 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -1,7 +1,7 @@ package com.ruoyi.system.service.impl; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; 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.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返回信息中的部门信息 - /*Map mapTest = (Map) JSON.parse(mapResult.get("result")); + Map map = (Map) JSON.parse(mapResult.get("result")); Map dataMap= (Map) map.get("data"); - JSONArray json = (JSONArray) o.get("dataList"); - List deptList = JSONArray.parseArray(json.toJSONString(), EcologyDept.class);*/ - Map map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class); + JSONArray json = (JSONArray) dataMap.get("dataList"); + List deptList = JSONArray.parseArray(json.toJSONString(), EcologyDept.class); + /*Map map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class); Map dataMap= new Gson().fromJson(new Gson().toJson(map.get("data")),HashMap.class); - List deptList= new Gson().fromJson(new Gson().toJson(dataMap.get("dataList")), new TypeToken>(){}.getType()); + List deptList= new Gson().fromJson(new Gson().toJson(dataMap.get("dataList")), new TypeToken>(){}.getType());*/ //清空部门表 deptMapper.truncateDept(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index baa2c5769..6b6cdf99e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -1,5 +1,7 @@ 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.reflect.TypeToken; import com.ruoyi.common.annotation.DataScope; @@ -547,14 +549,14 @@ public class SysUserServiceImpl implements ISysUserService } //取Ecology返回信息中的部门信息 - /*Map map = (Map) JSON.parse(mapResult.get("result")); + Map map = (Map) JSON.parse(mapResult.get("result")); Map dataMap= (Map) map.get("data"); JSONArray json = (JSONArray) dataMap.get("dataList"); - List ecologyUserList = JSONArray.parseArray(json.toJSONString(), EcologyUser.class);*/ - Map map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class); + List ecologyUserList = JSONArray.parseArray(json.toJSONString(), EcologyUser.class); + /*Map map = new Gson().fromJson(new Gson().toJson(mapResult.get("result")), HashMap.class); Map dataMap= new Gson().fromJson(new Gson().toJson(map.get("data")),HashMap.class); List ecologyUserList= new Gson().fromJson(dataMap.get("dataList").toString(), new TypeToken>(){}.getType()); - + */ //删除从Ecology同步过来(用户类型为02)的用户 userMapper.deleteEcologySyncUser();