增加TOPGP订阅快递及推送日志功能

修复根据快递单号获取快递公司编号问题
This commit is contained in:
Bo 2021-08-13 17:29:01 +08:00
parent 330f7eca9b
commit d9c6a862c2
20 changed files with 1084 additions and 227 deletions

View File

@ -53,7 +53,7 @@ public class ExpSubsPushApiController extends BaseController {
//接受topgp订阅
@Log(title = "快递订阅", businessType = BusinessType.OTHER)
@CrossOrigin
@ApiOperation(value="topgp订阅快递",notes = "request body格式 {\"deliveryNo\":\"S301-2108020001\",\"expressNo\":\"300444235610\",\"company\":\"annengwuliu\",\"phone\":\"13800138000\"}")
@ApiOperation(value="topgp订阅快递",notes = "request body格式 {\"requestId\":\"1628584040740\",\"deliveryNo\":\"S301-2108020001\",\"expressNo\":\"300444235610\",\"company\":\"annengwuliu\",\"phone\":\"13800138000\"}")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "requestJson", value = "请求json",required = true, paramType = "body", dataType = "String", dataTypeClass = String.class)

View File

@ -0,0 +1,126 @@
package com.ruoyi.bps.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bps.domain.ExpTopgpLog;
import com.ruoyi.bps.service.IExpTopgpLogService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* ERP订阅推送日志Controller
*
* @author Bo
* @date 2021-08-11
*/
@Controller
@RequestMapping("/bps/expTopgpLog")
public class ExpTopgpLogController extends BaseController
{
private String prefix = "bps/expTopgpLog";
@Autowired
private IExpTopgpLogService expTopgpLogService;
@RequiresPermissions("bps:expTopgpLog:view")
@GetMapping()
public String expTopgpLog()
{
return prefix + "/expTopgpLog";
}
/**
* 查询ERP订阅推送日志列表
*/
@RequiresPermissions("bps:expTopgpLog:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ExpTopgpLog expTopgpLog)
{
startPage();
List<ExpTopgpLog> list = expTopgpLogService.selectExpTopgpLogList(expTopgpLog);
return getDataTable(list);
}
/**
* 导出ERP订阅推送日志列表
*/
@RequiresPermissions("bps:expTopgpLog:export")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ExpTopgpLog expTopgpLog)
{
List<ExpTopgpLog> list = expTopgpLogService.selectExpTopgpLogList(expTopgpLog);
ExcelUtil<ExpTopgpLog> util = new ExcelUtil<ExpTopgpLog>(ExpTopgpLog.class);
return util.exportExcel(list, "ERP订阅推送日志数据");
}
/**
* 新增ERP订阅推送日志
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存ERP订阅推送日志
*/
@RequiresPermissions("bps:expTopgpLog:add")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ExpTopgpLog expTopgpLog)
{
return toAjax(expTopgpLogService.insertExpTopgpLog(expTopgpLog));
}
/**
* 修改ERP订阅推送日志
*/
@GetMapping("/edit/{sid}")
public String edit(@PathVariable("sid") Long sid, ModelMap mmap)
{
ExpTopgpLog expTopgpLog = expTopgpLogService.selectExpTopgpLogBySid(sid);
mmap.put("expTopgpLog", expTopgpLog);
return prefix + "/edit";
}
/**
* 修改保存ERP订阅推送日志
*/
@RequiresPermissions("bps:expTopgpLog:edit")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ExpTopgpLog expTopgpLog)
{
return toAjax(expTopgpLogService.updateExpTopgpLog(expTopgpLog));
}
/**
* 删除ERP订阅推送日志
*/
@RequiresPermissions("bps:expTopgpLog:remove")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(expTopgpLogService.deleteExpTopgpLogBySids(ids));
}
}

View File

@ -5,10 +5,11 @@ package com.ruoyi.bps.controller;
//import com.ruoyi.bps.express.request.QueryTrackParam;
//import com.ruoyi.bps.express.response.QueryTrackResp;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bps.service.IExpressService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.google.gson.Gson;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.request.QueryTrackParam;
import com.kuaidi100.sdk.response.QueryTrackResp;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -62,7 +63,8 @@ public class QueryExpressController extends BaseController {
System.out.println("快递公司:" + queryTrackParam.getCom());
System.out.println("电话:" + queryTrackParam.getPhone());
String info=expressService.QueryTrackExpress(queryTrackParam);
QueryTrackResp queryTrackResp = new Gson().fromJson(info,QueryTrackResp.class);
//QueryTrackResp queryTrackResp = new Gson().fromJson(info,QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(info,QueryTrackResp.class);
result = new HashMap<>();
result.put("code", "1");
result.put("msg", "ok");

View File

@ -50,6 +50,14 @@ public class ExpSubscribe extends BaseEntity
@Excel(name = "返回消息")
private String message;
/** 返回消息 */
@Excel(name = "请求方")
private String requestFrom;
/** 返回消息 */
@Excel(name = "请求ID")
private String requestId;
public void setSid(Long sid)
{
this.sid = sid;
@ -132,6 +140,26 @@ public class ExpSubscribe extends BaseEntity
return message;
}
public void setRequestFrom(String requestFrom)
{
this.requestFrom = requestFrom;
}
public String getRequestFrom()
{
return requestFrom;
}
public void setRequestId(String requestId)
{
this.requestId = requestId;
}
public String getRequestId()
{
return requestId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -144,6 +172,8 @@ public class ExpSubscribe extends BaseEntity
.append("result", getResult())
.append("returnCode", getReturnCode())
.append("message", getMessage())
.append("message", getMessage())
.append("message", getMessage())
.toString();
}
}

View File

@ -1,100 +1,149 @@
package com.ruoyi.bps.domain;
public class ExpTopgpLog {
Long Sid;
Long requestId;
String requestType;
String expressNumber;
String deliveryNumber;
String requestStr;
String requestTime;
String responseCode;
String responseStr;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
public Long getSid() {
return Sid;
/**
* ERP订阅推送日志对象 exp_topgp_log
*
* @author Bo
* @date 2021-08-11
*/
public class ExpTopgpLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** SID */
private Long sid;
/** 请求ID */
@Excel(name = "请求ID")
private String requestId;
/** 请求类型FromTopgpERP请求订阅、ToTopgpJava推送签收指令) */
@Excel(name = "请求类型", readConverterExp = "请求类型FromTopgpERP请求订阅、ToTopgpJava推送签收指令)")
private String requestType;
/** 快递单 */
@Excel(name = "快递单")
private String expressNumber;
/** 出货单号 */
@Excel(name = "出货单号")
private String deliveryNumber;
/** 请求报文 */
@Excel(name = "请求报文")
private String requestStr;
/** 请求时间 */
@Excel(name = "请求时间")
private String requestTime;
/** 返回code */
@Excel(name = "返回code")
private String responseCode;
/** 返回报文 */
@Excel(name = "返回报文")
private String responseStr;
public void setSid(Long sid)
{
this.sid = sid;
}
public void setSid(Long sid) {
Sid = sid;
public Long getSid()
{
return sid;
}
public Long getRequestId() {
return requestId;
}
public void setRequestId(Long requestId) {
public void setRequestId(String requestId)
{
this.requestId = requestId;
}
public String getRequestType() {
return requestType;
public String getRequestId()
{
return requestId;
}
public void setRequestType(String requestType) {
public void setRequestType(String requestType)
{
this.requestType = requestType;
}
public String getExpressNumber() {
return expressNumber;
public String getRequestType()
{
return requestType;
}
public void setExpressNumber(String expressNumber) {
public void setExpressNumber(String expressNumber)
{
this.expressNumber = expressNumber;
}
public String getDeliveryNumber() {
return deliveryNumber;
public String getExpressNumber()
{
return expressNumber;
}
public void setDeliveryNumber(String deliveryNumber) {
public void setDeliveryNumber(String deliveryNumber)
{
this.deliveryNumber = deliveryNumber;
}
public String getRequestStr() {
return requestStr;
public String getDeliveryNumber()
{
return deliveryNumber;
}
public void setRequestStr(String requestStr) {
public void setRequestStr(String requestStr)
{
this.requestStr = requestStr;
}
public String getRequestTime() {
return requestTime;
public String getRequestStr()
{
return requestStr;
}
public void setRequestTime(String requestTime) {
public void setRequestTime(String requestTime)
{
this.requestTime = requestTime;
}
public String getResponseCode() {
return responseCode;
public String getRequestTime()
{
return requestTime;
}
public void setResponseCode(String responseCode) {
public void setResponseCode(String responseCode)
{
this.responseCode = responseCode;
}
public String getResponseStr() {
return responseStr;
public String getResponseCode()
{
return responseCode;
}
public void setResponseStr(String responseStr)
{
this.responseStr = responseStr;
}
public void setResponseStr(String responseStr) {
this.responseStr = responseStr;
public String getResponseStr()
{
return responseStr;
}
@Override
public String toString() {
return "ExpSubscribeTopgpLog{" +
"Sid=" + Sid +
", requestId='" + requestId + '\'' +
", requestType='" + requestType + '\'' +
", expressNumber='" + expressNumber + '\'' +
", deliveryNumber='" + deliveryNumber + '\'' +
", requestStr='" + requestStr + '\'' +
", requestTime='" + requestTime + '\'' +
", responseCode='" + responseCode + '\'' +
", responseStr='" + responseStr + '\'' +
'}';
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("sid", getSid())
.append("requestId", getRequestId())
.append("requestType", getRequestType())
.append("expressNumber", getExpressNumber())
.append("deliveryNumber", getDeliveryNumber())
.append("requestStr", getRequestStr())
.append("requestTime", getRequestTime())
.append("responseCode", getResponseCode())
.append("responseStr", getResponseStr())
.toString();
}
}

View File

@ -36,7 +36,7 @@ public class ExpressInfo extends BaseEntity
private String ischeck;
/** 快递公司 */
@Excel(name = "快递公司",type= Excel.Type.EXPORT,dictType = "express_company")
@Excel(name = "快递公司",dictType= "express_company",dictTypeExceptImport = "true")
private String com;
/** 通信状态 */
@ -44,7 +44,7 @@ public class ExpressInfo extends BaseEntity
private String status;
/** 运单详情 */
@Excel(name = "运单详情",type= Excel.Type.EXPORT)
@Excel(name = "运单详情",type= Excel.Type.EXPORT,align = Excel.Align.LEFT)
private String data;
/** 当前状态 */

View File

@ -0,0 +1,61 @@
package com.ruoyi.bps.mapper;
import java.util.List;
import com.ruoyi.bps.domain.ExpTopgpLog;
/**
* ERP订阅推送日志Mapper接口
*
* @author Bo
* @date 2021-08-11
*/
public interface ExpTopgpLogMapper
{
/**
* 查询ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return ERP订阅推送日志
*/
public ExpTopgpLog selectExpTopgpLogBySid(Long sid);
/**
* 查询ERP订阅推送日志列表
*
* @param expTopgpLog ERP订阅推送日志
* @return ERP订阅推送日志集合
*/
public List<ExpTopgpLog> selectExpTopgpLogList(ExpTopgpLog expTopgpLog);
/**
* 新增ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int insertExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 修改ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int updateExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 删除ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return 结果
*/
public int deleteExpTopgpLogBySid(Long sid);
/**
* 批量删除ERP订阅推送日志
*
* @param sids 需要删除的数据主键集合
* @return 结果
*/
public int deleteExpTopgpLogBySids(String[] sids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.bps.service;
import java.util.List;
import com.ruoyi.bps.domain.ExpTopgpLog;
/**
* ERP订阅推送日志Service接口
*
* @author Bo
* @date 2021-08-11
*/
public interface IExpTopgpLogService
{
/**
* 查询ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return ERP订阅推送日志
*/
public ExpTopgpLog selectExpTopgpLogBySid(Long sid);
/**
* 查询ERP订阅推送日志列表
*
* @param expTopgpLog ERP订阅推送日志
* @return ERP订阅推送日志集合
*/
public List<ExpTopgpLog> selectExpTopgpLogList(ExpTopgpLog expTopgpLog);
/**
* 新增ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int insertExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 修改ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int updateExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 批量删除ERP订阅推送日志
*
* @param sids 需要删除的ERP订阅推送日志主键集合
* @return 结果
*/
public int deleteExpTopgpLogBySids(String sids);
/**
* 删除ERP订阅推送日志信息
*
* @param sid ERP订阅推送日志主键
* @return 结果
*/
public int deleteExpTopgpLogBySid(Long sid);
}

View File

@ -133,6 +133,8 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
/* try{*/
//将查询到的快递结果放到expressInfoListForInsert并插入到数据库表expressInfo
for( ExpressInfo expressInfo:expressInfoList){
//去除快递单号中的头尾空白符
expressInfo.setNu(expressInfo.getNu().trim());
ExpressInfo ei= expressInfoService.SelectExpressInfo(expressInfo);
ei.setQueryId(queryId);
ei.setQueryUserName(ShiroUtils.getSysUser().getUserName());
@ -165,10 +167,5 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
int message=expImportQueryMapper.insertExpImportQuery(expImportQuery);
return AjaxResult.success(message);
/*}catch (Exception e){
expImportQuery.setStatus("fail");
return AjaxResult.error(e.getMessage());
}*/
}
}

View File

@ -1,7 +1,7 @@
package com.ruoyi.bps.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.api.Subscribe;
import com.kuaidi100.sdk.contant.ApiInfoConstant;
import com.kuaidi100.sdk.core.IBaseClient;
@ -20,6 +20,7 @@ import com.ruoyi.bps.domain.ExpTopgpLog;
import com.ruoyi.bps.service.IExpSubsPushApiService;
import com.ruoyi.bps.service.IExpSubsPushRespService;
import com.ruoyi.bps.service.IExpSubscribeService;
import com.ruoyi.bps.service.IExpTopgpLogService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
@ -33,6 +34,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -60,6 +62,9 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
@Autowired
IExpSubscribeService expSubscribeService;
@Autowired
IExpTopgpLogService expTopgpLogService;
/**
* 订阅快递
* @throws Exception
@ -68,22 +73,27 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
public SubscribeResp ExpressSubscribe(ExpSubscribe expSubscribe) {
//如果订阅来源是topgp则来源为topgp,否则为local
String loginFrom= expSubscribe.getSalt();
String subscribeFrom= StringUtils.isNotEmpty(loginFrom)?loginFrom.equals("topgp")?"topgp":"local":"local";
/*String loginFrom= expSubscribe.getSalt();
String subscribeFrom= StringUtils.isNotEmpty(loginFrom)?loginFrom.equals("topgp")?"topgp":"local":"local";*/
if(StringUtils.isEmpty(expSubscribe.getRequestFrom())){
expSubscribe.setRequestFrom("local");
}
if( expSubscribe.getSid()==null || expSubscribe.getSid()==0) {
expSubscribe.setSid(System.currentTimeMillis()); //获取时间戳
if( StringUtils.isEmpty(expSubscribe.getRequestId())) {
//expSubscribe.setRequestId("local"+System.currentTimeMillis()); //获取时间戳,生成本地请求的requestId
expSubscribe.setRequestId("local"+ LocalDateTime.now());
}
if(StringUtils.isEmpty(expSubscribe.getSubscribeTime())){
expSubscribe.setSubscribeTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"));
}
String salt="bpsemi"; //定义salt字符串
//组合订阅参数
SubscribeParameters subscribeParameters = new SubscribeParameters();
SubscribeResp subscribeResp = new SubscribeResp();
subscribeParameters.setCallbackurl("http://report.bpsemi.cn:8081/it_war/anon/subscribeCallBackUrl");
subscribeParameters.setPhone(expSubscribe.getPhone());
subscribeParameters.setSalt("bpsemi");
subscribeParameters.setSalt(salt);
SubscribeParam subscribeParam = new SubscribeParam();
subscribeParam.setParameters(subscribeParameters);
subscribeParam.setCompany(expSubscribe.getCompany());
@ -92,13 +102,15 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
SubscribeReq subscribeReq = new SubscribeReq();
subscribeReq.setSchema(ApiInfoConstant.SUBSCRIBE_SCHEMA);
subscribeReq.setParam(new Gson().toJson(subscribeParam));
//subscribeReq.setParam(new Gson().toJson(subscribeParam));
subscribeReq.setParam(JSONObject.toJSONString(subscribeParam));
IBaseClient subscribe = new Subscribe();
try{
//推送订阅并获得快递100响应结果
HttpResult httpResult= subscribe.execute(subscribeReq);
subscribeResp= new Gson().fromJson(httpResult.getBody(),SubscribeResp.class);
//subscribeResp= new Gson().fromJson(httpResult.getBody(),SubscribeResp.class);
subscribeResp = JSONObject.parseObject(httpResult.getBody(),SubscribeResp.class);
}catch (Exception e)
{
return subscribeResp;
@ -116,11 +128,13 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
newExpSubscribe.setCompany(expSubscribe.getCompany());
newExpSubscribe.setNumber(expSubscribe.getNumber());
newExpSubscribe.setPhone(expSubscribe.getPhone());
newExpSubscribe.setSalt(subscribeFrom); //偷懒把请求来源记录到salt栏位不再增加exp_subscribe字段了以后找时间改吧
newExpSubscribe.setSalt(salt);
newExpSubscribe.setSubscribeTime(expSubscribe.getSubscribeTime());
newExpSubscribe.setResult((subscribeResp.isResult())?"true":"false");
newExpSubscribe.setReturnCode(subscribeResp.getReturnCode());
newExpSubscribe.setMessage(subscribeResp.getMessage());
newExpSubscribe.setRequestFrom(expSubscribe.getRequestFrom());
newExpSubscribe.setRequestId(expSubscribe.getRequestId());
/*ExpSubscribe queryExpSubscribe = new ExpSubscribe();
queryExpSubscribe.setCompany(expSubscribe.getCompany());
@ -146,8 +160,91 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
return subscribeResp;
}
/**
* 获取从快递100订阅的快递推送信息并返回响应结果
* 处理Topgp推送的快递订阅请求向快递100推送订阅请求并将结果返回给TOPGP
*
* @param request
* @return
*/
@Override
public String ExpressSubscribeFromTopgp(HttpServletRequest request) throws IOException {
//定义Return变量
String retrunStr;
//获取httpServletRequest传过来的Json字符串并进行解析
JSONObject contentJson= JSONObject.parseObject(ServletUtils.getRequestContent(request));
if(StringUtils.isEmpty(contentJson)){
return "貌似没有接受到任何参数!";
}
String requestId=contentJson.getString("requestId"); //TOPGP请求ID年月日时分稍毫秒
String deliveryNo= contentJson.getString("deliveryNo"); //TOPGP出货单号
String expressNo = contentJson.getString("expressNo"); //TOPGP快递单号
String company = contentJson.getString("company"); //TOPGP物流公司编号
String phone = contentJson.getString("phone"); //TOPGP出货单号
//Long timeStamp = System.currentTimeMillis(); //获取时间戳
String subscribeTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"); //获取订阅时间
SubscribeResp subscribeResp=new SubscribeResp();
//如果请求ID出货单号或者快递单号为空,则不向快递100请求订阅自己组合返回信息
if(StringUtils.isEmpty(deliveryNo) || StringUtils.isEmpty(expressNo) || StringUtils.isEmpty(requestId)){
subscribeResp.setMessage("请求ID、快递单号或出货单号不可为空");
subscribeResp.setResult(false);
subscribeResp.setReturnCode("700");
}else {
//组合向快递100推送订阅请求的参数
ExpSubscribe expSubscribe=new ExpSubscribe();
expSubscribe.setSid(Long.getLong(requestId)); //时间戳
expSubscribe.setNumber(expressNo);
expSubscribe.setCompany(company);
expSubscribe.setPhone(phone);
expSubscribe.setSubscribeTime(subscribeTime); //订阅时间
expSubscribe.setSalt("topgp"); //
//向快递100推送订阅请求取得订阅返回结果
subscribeResp= ExpressSubscribe(expSubscribe);
}
//根据快递100的订阅返回结果组合返回Topgp的JSON字符串
Map<String,Object> map= new HashMap<>();
map.put("requestId",requestId); //从TOPGP传过来的requestId 时间戳
map.put("deliveryNo",deliveryNo); //出货单号
map.put("expressNo",expressNo); //快递单号
map.put("responseStr",subscribeResp.getMessage()); //返回消息
map.put("responseCode",subscribeResp.getReturnCode()); //返回码
map.put("result",subscribeResp.isResult()); //订阅结果
//返回Json字符串给TOPGP
retrunStr= JSONObject.toJSONString(map);
//记录本次TOPGP订阅请求的Log
ExpTopgpLog expTopgpLog=new ExpTopgpLog();
expTopgpLog.setRequestId(requestId);
expTopgpLog.setRequestType("fromTopgp");
expTopgpLog.setExpressNumber(expressNo);
expTopgpLog.setDeliveryNumber(deliveryNo);
expTopgpLog.setRequestStr(contentJson.toString());
expTopgpLog.setRequestTime(subscribeTime);
expTopgpLog.setResponseCode(subscribeResp.getReturnCode());
expTopgpLog.setResponseStr(retrunStr);
expTopgpLogService.insertExpTopgpLog(expTopgpLog);
//返回TOPGP json字符串
return retrunStr;
}
public JSONObject SendRequestToTopgp( String url,String tip,Map<String,Object> map) {
String param = TopgpXmlUtils.GetTopgpRequestXml(tip, map);
String returnXml = HttpUtils.sendXmlPost(url, param);
return TopgpXmlUtils.GetStatusFromTopgpResponse(returnXml);
}
/**
* 处理快递100订阅的快递推送信息并返回响应结果
*
* @param request 快递100推送的订阅信息
* @return 结果
@ -181,7 +278,8 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
//加密相等继续处理业务逻辑
subscribeResp.setMessage("接受成功!加密验证通过【sign】"+sign+"【ourSign】"+ourSign);
SubscribePushParamResp subscribePushParamResp = new Gson().fromJson(param, SubscribePushParamResp.class);
//SubscribePushParamResp subscribePushParamResp = new Gson().fromJson(param, SubscribePushParamResp.class);
SubscribePushParamResp subscribePushParamResp=JSONObject.parseObject(param,SubscribePushParamResp.class);
SubscribePushResult subscribePushResult = subscribePushParamResp.getLastResult();
//快递单号
String nu = subscribePushResult.getNu();
@ -195,24 +293,42 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
}
//快递单当前状态 0在途1揽收2疑难3签收4退签5派件6退回7转单10待清关11清关中12已清关13清关异常14收件人拒签)
String state = subscribePushResult.getState();
//if(state.equals("3")){
//处理签收逻辑
//todo
//如果是快递100推送的快递单状态为签收state=3,并且TOPGP未反馈该快递单已被签收
if(state.equals("3")) {
//如果该快递单号是由TOPGP订阅的话则推送给TOPGP
ExpSubscribe expSubscribe=new ExpSubscribe();
expSubscribe.setCompany(subscribePushResult.getCom());
expSubscribe.setNumber(subscribePushResult.getNu());
expSubscribe.setSalt("topgp");
expSubscribeService.selectExpSubscribeList(expSubscribe);
//如果该快递信息没有推送给TOPGP且TOPGP已反馈生成签收单成功记录则推送给TOPGP
ExpTopgpLog expTopgpLog=new ExpTopgpLog();
expTopgpLog.setExpressNumber(subscribePushResult.getNu());
expTopgpLog.setRequestType("toTopgp");
expTopgpLog.setResponseCode("200");
List<ExpTopgpLog> expTopgpLogList= expTopgpLogService.selectExpTopgpLogList(expTopgpLog);
if(null==expTopgpLogList || expTopgpLogList.size()<1){
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("expressNum", subscribePushResult.getNu());
requestMap.put("expressCom", subscribePushResult.getCom());
requestMap.put("expressState", subscribePushResult.getState());
requestMap.put("requestTime", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"));
//一个快递单号对应多个出货单请求
//调用topgp Webservice接口
//topgp返回的
JSONObject jsonObject= SendRequestToTopgp(webserviceUrl, "express_testRequest",requestMap);
log.info(jsonObject.toJSONString());
if(jsonObject.getString("returnCode").equals("200")){
//一个快递单号对应多个出货单号怎么处理如果有多个出货单号部分已签收部分未签收又怎么处理 如果推送到ERP时ERP已经人工生成签收单了又该怎么处理
}
}
}
//将快递流转状态存入数据库
@ -234,7 +350,7 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
//如果数据库中没有快递单号+快递公司编码则更插入新记录
expSubsPushRespService.insertExpSubsPushResp(ToExpSubsPushResp(subscribePushParamResp));
}*/
// }
return subscribeResp;
}
@ -305,86 +421,6 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
}
/**
* 获取Topgp推送的快递信息向快递100推送订阅请求
*
* @param request
* @return
*/
@Override
public String ExpressSubscribeFromTopgp(HttpServletRequest request) throws IOException {
//定义Return变量
String retrunStr;
//获取httpServletRequest传过来的Json字符串并进行解析
JSONObject contentJson= JSONObject.parseObject(ServletUtils.getRequestContent(request));
String requestId=contentJson.getString("requestID"); //TOPGP请求ID年月日时分稍毫秒
String deliveryNo= contentJson.getString("deliveryNo"); //TOPGP出货单号
String expressNo = contentJson.getString("expressNo"); //TOPGP快递单号
String company = contentJson.getString("company"); //TOPGP物流公司编号
String phone = contentJson.getString("phone"); //TOPGP出货单号
Long timeStamp = System.currentTimeMillis(); //获取时间戳
String subscribeTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"); //获取订阅时间
String responseCode; //返回给Topgp的返回码
//如果请求ID出货单号或者快递单号为空的处理
if(StringUtils.isEmpty(deliveryNo) || StringUtils.isEmpty(expressNo) || StringUtils.isEmpty(requestId)){
SubscribeResp subscribeResp=new SubscribeResp();
subscribeResp.setMessage("快递单号或出货单号为空");
subscribeResp.setResult(false);
subscribeResp.setReturnCode("700");
responseCode="700";
Map<String,Object> map=new HashMap<>();
map.put("subscribeResp",subscribeResp);
map.put("deliveryNo",deliveryNo);
map.put("expressNo",expressNo);
//返回错误信息
retrunStr= JSONObject.toJSONString(map);
}else {
//组合向快递100推送订阅请求的参数
ExpSubscribe expSubscribe=new ExpSubscribe();
expSubscribe.setSid(timeStamp); //时间戳
expSubscribe.setNumber(expressNo);
expSubscribe.setCompany(company);
expSubscribe.setPhone(phone);
expSubscribe.setSubscribeTime(subscribeTime); //订阅时间
expSubscribe.setSalt("topgp"); // 订阅来源 偷懒把请求来源记录到salt栏位不再增加exp_subscribe字段了以后找时间改吧
//向快递100推送订阅请求取得订阅返回结果
SubscribeResp subscribeResp= ExpressSubscribe(expSubscribe);
responseCode =subscribeResp.getReturnCode();
//根据快递100的订阅返回结果组合返回Topgp的JSON字符串
Map<String,Object> map= new HashMap<>();
map.put("requestId",timeStamp); //时间戳
map.put("expSubscribe",subscribeResp); //快递100的返回结果报文
map.put("deliveryNo",deliveryNo); //出货单号
map.put("expressNo",expressNo); //快递单号
map.put("responseCode",subscribeResp.getReturnCode()); //返回码
//返回Json字符串给TOPGP
retrunStr= JSONObject.toJSONString(map);
}
//记录本次TOPGP订阅请求的Log
ExpTopgpLog expTopgpLog=new ExpTopgpLog();
expTopgpLog.setRequestId(timeStamp);
expTopgpLog.setRequestType("fromTopgp");
expTopgpLog.setExpressNumber(expressNo);
expTopgpLog.setDeliveryNumber(deliveryNo);
expTopgpLog.setRequestStr(contentJson.toString());
expTopgpLog.setRequestTime(subscribeTime);
expTopgpLog.setResponseCode(responseCode);
//返回TOPGP json字符串
return retrunStr;
}
public JSONObject SendRequestToTopgp( String url,String tip,Map<String,Object> map) {
String param = TopgpXmlUtils.GetTopgpRequestXml(tip, map);
String returnXml = HttpUtils.sendXmlPost(url, param);
return TopgpXmlUtils.GetStatusFromTopgpResponse(returnXml);
}
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.bps.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bps.mapper.ExpTopgpLogMapper;
import com.ruoyi.bps.domain.ExpTopgpLog;
import com.ruoyi.bps.service.IExpTopgpLogService;
import com.ruoyi.common.core.text.Convert;
/**
* ERP订阅推送日志Service业务层处理
*
* @author Bo
* @date 2021-08-11
*/
@Service
public class ExpTopgpLogServiceImpl implements IExpTopgpLogService
{
@Autowired
private ExpTopgpLogMapper expTopgpLogMapper;
/**
* 查询ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return ERP订阅推送日志
*/
@Override
public ExpTopgpLog selectExpTopgpLogBySid(Long sid)
{
return expTopgpLogMapper.selectExpTopgpLogBySid(sid);
}
/**
* 查询ERP订阅推送日志列表
*
* @param expTopgpLog ERP订阅推送日志
* @return ERP订阅推送日志
*/
@Override
public List<ExpTopgpLog> selectExpTopgpLogList(ExpTopgpLog expTopgpLog)
{
return expTopgpLogMapper.selectExpTopgpLogList(expTopgpLog);
}
/**
* 新增ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
@Override
public int insertExpTopgpLog(ExpTopgpLog expTopgpLog)
{
return expTopgpLogMapper.insertExpTopgpLog(expTopgpLog);
}
/**
* 修改ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
@Override
public int updateExpTopgpLog(ExpTopgpLog expTopgpLog)
{
return expTopgpLogMapper.updateExpTopgpLog(expTopgpLog);
}
/**
* 批量删除ERP订阅推送日志
*
* @param sids 需要删除的ERP订阅推送日志主键
* @return 结果
*/
@Override
public int deleteExpTopgpLogBySids(String sids)
{
return expTopgpLogMapper.deleteExpTopgpLogBySids(Convert.toStrArray(sids));
}
/**
* 删除ERP订阅推送日志信息
*
* @param sid ERP订阅推送日志主键
* @return 结果
*/
@Override
public int deleteExpTopgpLogBySid(Long sid)
{
return expTopgpLogMapper.deleteExpTopgpLogBySid(sid);
}
}

View File

@ -1,5 +1,8 @@
package com.ruoyi.bps.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bps.domain.ExpressInfo;
import com.ruoyi.bps.mapper.ExpressInfoMapper;
import com.ruoyi.bps.service.IExpressInfoService;
@ -7,7 +10,7 @@ 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.google.gson.Gson;
import com.kuaidi100.sdk.api.AutoNum;
import com.kuaidi100.sdk.api.QueryTrack;
import com.kuaidi100.sdk.core.IBaseClient;
@ -132,11 +135,17 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
callbackExpressInfo.setDeliveryNum(deliveryNum);
//如果没有输入快递公司编号则查询快递公司编号
if(StringUtils.isEmpty(com)){
if(AutoGetExpressCom(nu)==null){
callbackExpressInfo.setData("请提供要查询的快递所属物流公司编号!");
List<AutoNumResp> list= AutoGetExpressCom(nu);
if(null==list || list.size()<1){
callbackExpressInfo.setData("请提供要查询的快递所属物流公司编号!,且根据快递单号没有查询到物流公司编号!");
return callbackExpressInfo;
}
com=AutoGetExpressCom(nu).getComCode();
if (list.size()>1)
{
callbackExpressInfo.setData("您没有提供要查询的快递所属物流公司编号,且根据快递单号查询到多个物流公司编号");
return callbackExpressInfo;
}
com=list.get(0).getComCode();
}
callbackExpressInfo.setCom(com);
@ -152,7 +161,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
queryTrackParam.setPhone(expressInfo.getPhone());
//获取快递信息
String param = new Gson().toJson(queryTrackParam);
//String param = new Gson().toJson(queryTrackParam);
String param= JSONObject.toJSONString(queryTrackParam);
QueryTrackReq queryTrackReq=new QueryTrackReq();
queryTrackReq.setParam(param);
queryTrackReq.setCustomer(customer);
@ -168,7 +178,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
}
//将快递信息转化为QueryTrackResp对象
QueryTrackResp queryTrackResp = new Gson().fromJson(msg,QueryTrackResp.class);
//QueryTrackResp queryTrackResp = new Gson().fromJson(msg,QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(msg,QueryTrackResp.class);
//如果没有查到物流信息则返回错误信息
if(StringUtils.isEmpty(queryTrackResp.getStatus()) || !queryTrackResp.getStatus().equals("200")){
@ -233,21 +244,30 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
* @return 快递公司编码
*/
private AutoNumResp AutoGetExpressCom(String num){
private List<AutoNumResp> AutoGetExpressCom(String num){
AutoNumReq autoNumReq = new AutoNumReq();
autoNumReq.setKey(key);
autoNumReq.setNum(num);
autoNumReq.setNum(num.trim());
IBaseClient baseClient = new AutoNum();
AutoNumResp autoNumResp=new AutoNumResp();
//AutoNumResp autoNumResp=new AutoNumResp();
List<AutoNumResp> autoNumRespList=new ArrayList<>();
try {
String str= baseClient.execute(autoNumReq).getBody().replace("[","").replace("]","");
autoNumResp = new Gson().fromJson(str,AutoNumResp.class);
JSONArray jsonArray= JSONArray.parseArray(baseClient.execute(autoNumReq).getBody());
if(StringUtils.isEmpty(jsonArray))
{
return null;
}
for (Object object:jsonArray)
{
autoNumRespList.add(JSONObject.parseObject(JSONObject.toJSONString(object),AutoNumResp.class));
}
} catch (Exception e) {
e.printStackTrace();
}
return autoNumResp;
//return autoNumResp;
return autoNumRespList;
}
/**

View File

@ -1,7 +1,9 @@
package com.ruoyi.bps.service.impl;
import com.google.gson.Gson;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.api.QueryTrack;
import com.kuaidi100.sdk.api.Subscribe;
import com.kuaidi100.sdk.contant.ApiInfoConstant;
@ -12,7 +14,7 @@ import com.kuaidi100.sdk.response.QueryTrackResp;
import com.kuaidi100.sdk.utils.PropertiesReader;
import com.kuaidi100.sdk.utils.SignUtils;
import com.ruoyi.bps.service.IExpressService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -22,20 +24,7 @@ import java.util.List;
@Service
public class ExpressServiceImpl implements IExpressService {
/*
String key = "Jydbrxsm2311";
String customer = "2DD48B3469B82F2B7700569093AB792B";
String secret = "8781ed9b35a7438499eb02fee915915a";
String userid = "2a62da2192c24d17a943ff78ee64f8c6";
*/
/*String key = PropertiesReader.get("key");
String customer = PropertiesReader.get("customer");
String secret = PropertiesReader.get("secret");
String siid = PropertiesReader.get("siid");
String userid = PropertiesReader.get("userid");
String tid = PropertiesReader.get("tid");
String secret_key = PropertiesReader.get("secret_key");
String secret_secret = PropertiesReader.get("secret_secret");*/
/*String key = PropertiesReader.get("key");*/
@Value("${express.key}")
private String key;
@ -53,7 +42,8 @@ public class ExpressServiceImpl implements IExpressService {
for(QueryTrackParam queryTrackParam:list)
{
QueryTrackResp queryTrackResp = new Gson().fromJson(expressService.QueryTrackExpress(queryTrackParam),QueryTrackResp.class);
//QueryTrackResp queryTrackResp = new Gson().fromJson(expressService.QueryTrackExpress(queryTrackParam),QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(expressService.QueryTrackExpress(queryTrackParam),QueryTrackResp.class);
qtList.add(queryTrackResp);
}
return qtList;
@ -78,7 +68,8 @@ public class ExpressServiceImpl implements IExpressService {
public String QueryTrackExpress(QueryTrackParam queryTrackParam) {
String str="";
QueryTrackReq queryTrackReq = new QueryTrackReq();
String param = new Gson().toJson(queryTrackParam);
//String param = new Gson().toJson(queryTrackParam);
String param = JSONObject.toJSONString(queryTrackParam);
queryTrackReq.setParam(param);
queryTrackReq.setCustomer(customer);
@ -93,24 +84,17 @@ public class ExpressServiceImpl implements IExpressService {
msg=e.toString();
}
JSONObject jsonObject = new JSONObject(msg);
if (jsonObject.has("returnCode")){
QueryTrackResp queryTrackResp= new Gson().fromJson(msg,QueryTrackResp.class);
//JSONObject jsonObject = new JSONObject(msg);
JSONObject jsonObject = JSON.parseObject(msg);
if (jsonObject.containsKey("returnCode")){
//QueryTrackResp queryTrackResp= new Gson().fromJson(msg,QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(msg,QueryTrackResp.class);
queryTrackResp.setStatus(queryTrackResp.getReturnCode());
queryTrackResp.setNu(queryTrackParam.getNum());
msg= new Gson().toJson(queryTrackResp);
//msg= new Gson().toJson(queryTrackResp);
msg= JSONObject.toJSONString(queryTrackResp);
}
/* else {
QueryTrackResp queryTrackResp=new Gson().fromJson(msg,QueryTrackResp.class);
for(int i=0;i<queryTrackResp.getData().size();i++) {
QueryTrackData queryTrackData = queryTrackResp.getData().get(i);
str += "时间:" + queryTrackData.getTime();
str += " 物流信息:" + queryTrackData.getContext();
str += " 格式化后时间+" + queryTrackData.getFtime();
} *
}*/
// System.out.println(msg);
return msg;
}
@ -130,7 +114,8 @@ public class ExpressServiceImpl implements IExpressService {
SubscribeReq subscribeReq = new SubscribeReq();
subscribeReq.setSchema(ApiInfoConstant.SUBSCRIBE_SCHEMA); //返回的数据格式必须
subscribeReq.setParam(new Gson().toJson(subscribeParam));
//subscribeReq.setParam(new Gson().toJson(subscribeParam));
subscribeReq.setParam(JSONObject.toJSONString(subscribeParam));
IBaseClient subscribe = new Subscribe();
try{

View File

@ -14,10 +14,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="result" column="result" />
<result property="returnCode" column="returnCode" />
<result property="message" column="message" />
<result property="requestFrom" column="requestFrom" />
<result property="requestId" column="requestId" />
</resultMap>
<sql id="selectExpSubscribeVo">
select sid, company, number, phone, salt, subscribeTime, result, returnCode, message from exp_subscribe
select sid, company, number, phone, salt, subscribeTime, result, returnCode, message, requestFrom, requestId from exp_subscribe
</sql>
<select id="selectExpSubscribeList" parameterType="ExpSubscribe" resultMap="ExpSubscribeResult">
@ -29,6 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="subscribeTime != null and subscribeTime != ''"> and subscribeTime like concat('%', #{subscribeTime}, '%')</if>
<if test="result != null and result != ''"> and result = #{result}</if>
<if test="returnCode != null and returnCode != ''"> and returnCode = #{returnCode}</if>
<if test="requestFrom != null and requestFrom != ''"> and requestFrom = #{requestFrom}</if>
<if test="requestId != null and requestId != ''"> and requestId = #{requestId}</if>
</where>
</select>
@ -48,6 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="result != null">result,</if>
<if test="returnCode != null">returnCode,</if>
<if test="message != null">message,</if>
<if test="requestFrom != null">requestFrom,</if>
<if test="requestId != null">requestId,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="company != null">#{company},</if>
@ -58,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="result != null">#{result},</if>
<if test="returnCode != null">#{returnCode},</if>
<if test="message != null">#{message},</if>
<if test="requestFrom != null">#{requestFrom},</if>
<if test="requestId != null">#{requestId},</if>
</trim>
</insert>
@ -72,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="result != null">result = #{result},</if>
<if test="returnCode != null">returnCode = #{returnCode},</if>
<if test="message != null">message = #{message},</if>
<if test="requestFrom != null">requestFrom = #{requestFrom},</if>
<if test="requestId != null">requestId = #{requestId},</if>
</trim>
where sid = #{sid}
</update>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bps.mapper.ExpTopgpLogMapper">
<resultMap type="ExpTopgpLog" id="ExpTopgpLogResult">
<result property="sid" column="sid" />
<result property="requestId" column="requestId" />
<result property="requestType" column="requestType" />
<result property="expressNumber" column="expressNumber" />
<result property="deliveryNumber" column="deliveryNumber" />
<result property="requestStr" column="requestStr" />
<result property="requestTime" column="requestTime" />
<result property="responseCode" column="responseCode" />
<result property="responseStr" column="responseStr" />
</resultMap>
<sql id="selectExpTopgpLogVo">
select sid, requestId, requestType, expressNumber, deliveryNumber, requestStr, requestTime, responseCode, responseStr from exp_topgp_log
</sql>
<select id="selectExpTopgpLogList" parameterType="ExpTopgpLog" resultMap="ExpTopgpLogResult">
<include refid="selectExpTopgpLogVo"/>
<where>
<if test="requestId != null and requestId != ''"> and requestId = #{requestId}</if>
<if test="requestType != null and requestType != ''"> and requestType = #{requestType}</if>
<if test="expressNumber != null and expressNumber != ''"> and expressNumber = #{expressNumber}</if>
<if test="deliveryNumber != null and deliveryNumber != ''"> and deliveryNumber = #{deliveryNumber}</if>
<if test="requestStr != null and requestStr != ''"> and requestStr = #{requestStr}</if>
<if test="requestTime != null and requestTime != ''"> and requestTime = #{requestTime}</if>
<if test="responseCode != null and responseCode != ''"> and responseCode = #{responseCode}</if>
<if test="responseStr != null and responseStr != ''"> and responseStr = #{responseStr}</if>
</where>
</select>
<select id="selectExpTopgpLogBySid" parameterType="Long" resultMap="ExpTopgpLogResult">
<include refid="selectExpTopgpLogVo"/>
where sid = #{sid}
</select>
<insert id="insertExpTopgpLog" parameterType="ExpTopgpLog" useGeneratedKeys="true" keyProperty="sid">
insert into exp_topgp_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="requestId != null">requestId,</if>
<if test="requestType != null">requestType,</if>
<if test="expressNumber != null">expressNumber,</if>
<if test="deliveryNumber != null">deliveryNumber,</if>
<if test="requestStr != null">requestStr,</if>
<if test="requestTime != null">requestTime,</if>
<if test="responseCode != null">responseCode,</if>
<if test="responseStr != null">responseStr,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="requestId != null">#{requestId},</if>
<if test="requestType != null">#{requestType},</if>
<if test="expressNumber != null">#{expressNumber},</if>
<if test="deliveryNumber != null">#{deliveryNumber},</if>
<if test="requestStr != null">#{requestStr},</if>
<if test="requestTime != null">#{requestTime},</if>
<if test="responseCode != null">#{responseCode},</if>
<if test="responseStr != null">#{responseStr},</if>
</trim>
</insert>
<update id="updateExpTopgpLog" parameterType="ExpTopgpLog">
update exp_topgp_log
<trim prefix="SET" suffixOverrides=",">
<if test="requestId != null">requestId = #{requestId},</if>
<if test="requestType != null">requestType = #{requestType},</if>
<if test="expressNumber != null">expressNumber = #{expressNumber},</if>
<if test="deliveryNumber != null">deliveryNumber = #{deliveryNumber},</if>
<if test="requestStr != null">requestStr = #{requestStr},</if>
<if test="requestTime != null">requestTime = #{requestTime},</if>
<if test="responseCode != null">responseCode = #{responseCode},</if>
<if test="responseStr != null">responseStr = #{responseStr},</if>
</trim>
where sid = #{sid}
</update>
<delete id="deleteExpTopgpLogBySid" parameterType="Long">
delete from exp_topgp_log where sid = #{sid}
</delete>
<delete id="deleteExpTopgpLogBySids" parameterType="String">
delete from exp_topgp_log where sid in
<foreach item="sid" collection="array" open="(" separator="," close=")">
#{sid}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增ERP订阅推送日志')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-expTopgpLog-add">
<div class="form-group">
<label class="col-sm-3 control-label">请求ID</label>
<div class="col-sm-8">
<input name="requestId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求类型:</label>
<div class="col-sm-8">
<input name="requestType" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">快递单:</label>
<div class="col-sm-8">
<input name="expressNumber" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出货单号:</label>
<div class="col-sm-8">
<input name="deliveryNumber" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求报文:</label>
<div class="col-sm-8">
<textarea name="requestStr" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求时间:</label>
<div class="col-sm-8">
<input name="requestTime" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回code</label>
<div class="col-sm-8">
<input name="responseCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回报文:</label>
<div class="col-sm-8">
<textarea name="responseStr" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "bps/expTopgpLog"
$("#form-expTopgpLog-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-expTopgpLog-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改ERP订阅推送日志')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-expTopgpLog-edit" th:object="${expTopgpLog}">
<input name="sid" th:field="*{sid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">请求ID</label>
<div class="col-sm-8">
<input name="requestId" th:field="*{requestId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求类型:</label>
<div class="col-sm-8">
<input name="requestType" th:field="*{requestType}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">快递单:</label>
<div class="col-sm-8">
<input name="expressNumber" th:field="*{expressNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出货单号:</label>
<div class="col-sm-8">
<input name="deliveryNumber" th:field="*{deliveryNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求报文:</label>
<div class="col-sm-8">
<textarea name="requestStr" class="form-control">[[*{requestStr}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求时间:</label>
<div class="col-sm-8">
<input name="requestTime" th:field="*{requestTime}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回code</label>
<div class="col-sm-8">
<input name="responseCode" th:field="*{responseCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回报文:</label>
<div class="col-sm-8">
<textarea name="responseStr" class="form-control">[[*{responseStr}]]</textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "bps/expTopgpLog";
$("#form-expTopgpLog-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-expTopgpLog-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('ERP订阅推送日志列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>请求ID</label>
<input type="text" name="requestId"/>
</li>
<li>
<label>请求类型:</label>
<input type="text" name="requestType"/>
</li>
<li>
<label>快递单:</label>
<input type="text" name="expressNumber"/>
</li>
<li>
<label>出货单号:</label>
<input type="text" name="deliveryNumber"/>
</li>
<li>
<label>请求时间:</label>
<input type="text" name="requestTime"/>
</li>
<li>
<label>返回code</label>
<input type="text" name="responseCode"/>
</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-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="bps:expTopgpLog:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="bps:expTopgpLog:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="bps:expTopgpLog:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="bps:expTopgpLog:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('bps:expTopgpLog:edit')}]];
var removeFlag = [[${@permission.hasPermi('bps:expTopgpLog:remove')}]];
var prefix = ctx + "bps/expTopgpLog";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
sortName: "requesttime", //不要用驼峰式变量requestTimemybatis会转换成request_time
sortOrder: "desc",
modalName: "ERP订阅推送日志",
columns: [{
checkbox: true
},
{
field: 'sid',
title: 'SID',
visible: false
},
{
field: 'requestId',
title: '请求ID'
},
{
field: 'requestType',
title: '请求类型'
},
{
field: 'expressNumber',
title: '快递单'
},
{
field: 'deliveryNumber',
title: '出货单号'
},
{
field: 'requestStr',
title: '请求报文'
},
{
field: 'requestTime',
title: '请求时间'
},
{
field: 'responseCode',
title: '返回code'
},
{
field: 'responseStr',
title: '返回报文'
},
{
title: '操作',
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.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('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -35,6 +35,16 @@ public @interface Excel
*/
public String dictType() default "";
/**
* 如果使用字典转换但不希望导入时转换则dictTypeExceptImport="true";
*/
public String dictTypeExceptImport() default "";
/**
* 如果使用字典转换但不希望导出时转换则dictTypeExceptExport="true"
*/
public String dictTypeExceptExport() default "";
/**
* 读取内容转表达式 (: 0=,1=,2=未知)
*/

View File

@ -315,7 +315,7 @@ public class ExcelUtil<T>
{
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
}
else if (StringUtils.isNotEmpty(attr.dictType()))
else if (StringUtils.isNotEmpty(attr.dictType()) && StringUtils.isEmpty(attr.dictTypeExceptImport()))
{
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
}
@ -694,7 +694,8 @@ public class ExcelUtil<T>
{
cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator));
}
else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value))
else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value) && StringUtils.isEmpty(attr.dictTypeExceptExport()))
{
cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator));
}