2024-07-12 07:40:42 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Project: emis
|
|
|
|
|
* @Title: EmisBrandController.java
|
|
|
|
|
* @author linfso
|
|
|
|
|
* @date 2023-12-14 13:02:48
|
|
|
|
|
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
|
|
|
|
* @version v1.0
|
|
|
|
|
* @Description: <p> 品牌 控制器 </p>
|
|
|
|
|
*/
|
|
|
|
|
|
2024-07-12 09:17:32 +00:00
|
|
|
package com.xdadan.erp.apiweb;
|
2024-07-12 07:40:42 +00:00
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.xdadan.erp.common.core.controller.BaseController;
|
|
|
|
|
import com.xdadan.erp.common.core.domain.AjaxResult;
|
|
|
|
|
import com.xdadan.erp.common.core.redis.RedissonService;
|
|
|
|
|
import com.xdadan.erp.common.utils.DateUtils;
|
|
|
|
|
import com.xdadan.erp.common.utils.SecurityUtils;
|
|
|
|
|
import com.xdadan.erp.emis.domain.EmisPrintTpl;
|
|
|
|
|
import com.xdadan.erp.emis.domain.EmisSite;
|
|
|
|
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
|
|
|
|
import com.xdadan.erp.emis.domain.vo.AddressParseResult;
|
|
|
|
|
import com.xdadan.erp.emis.service.*;
|
|
|
|
|
import com.xdadan.erp.emis.utils.WaybillHelper;
|
|
|
|
|
import com.xdadan.erp.system.service.ISysConfigService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* EMIS 公共 Controller
|
|
|
|
|
*
|
|
|
|
|
* @author linfso
|
|
|
|
|
* @date 2023-12-14 13:02:48
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
2024-07-12 09:11:16 +00:00
|
|
|
@RequestMapping("/apiweb/common")
|
|
|
|
|
public class CommonController extends BaseController
|
2024-07-12 07:40:42 +00:00
|
|
|
{
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisTmsScanRecordService emisTmsScanRecordService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisElectronicSitePagService emisElectronicSitePagService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisElectronicPagService emisElectronicPagService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisRegionService emisRegionService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysConfigService configService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmisBaseService emisBaseService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisPrintTplService emisPrintTplService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
RedissonService redissonService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取中心可用简单数
|
|
|
|
|
* @param prefix
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/getCenterTotalAvailablePag")
|
|
|
|
|
public AjaxResult getCenterTotalAvailablePag(String prefix)
|
|
|
|
|
{
|
|
|
|
|
return AjaxResult.success("获取成功",emisElectronicPagService.getCenterTotalAvailablePag("T7080"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取网点总可用面单数
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/getTotalAvailablePag")
|
|
|
|
|
public AjaxResult getTotalAvailablePag(String useSiteCode,String prefix)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
if(StringUtils.isEmpty(useSiteCode)){
|
|
|
|
|
try {
|
|
|
|
|
useSiteCode= SecurityUtils.getLoginUser().getUser().getOwnerSiteCode();
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Map dataMap = emisElectronicSitePagService.getTotalAvailablePag(useSiteCode,"T7080");
|
|
|
|
|
return AjaxResult.success("获取成功",dataMap);
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error(ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取APP版本
|
|
|
|
|
{
|
|
|
|
|
version: '1.0.1',
|
|
|
|
|
versionCode: 101,
|
|
|
|
|
apkUrl: 'http://192.168.1.7:5173/static/t.apk',
|
|
|
|
|
// apkUrl: 'http://oss-emis.tanex56.com/sapp/sdg/hdbg.png',
|
|
|
|
|
wgtUrl: 'http://192.168.1.7:5173/static/t.wgt?t.wgt',
|
|
|
|
|
// whiteDeviceIds: ['F9E778C90D0E9A8DA9D95AA97B00A3FB'],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/getLastAppVersion")
|
|
|
|
|
public AjaxResult getLastAppVersion()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
String lastAppVersionStr = configService.selectConfigByKey("sys.app.version");
|
|
|
|
|
JSONObject obj=JSONObject.parseObject(lastAppVersionStr);
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("获取成功",obj);
|
|
|
|
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error(ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取电子面单单号
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/realMatchWaybill")
|
|
|
|
|
public AjaxResult realMatchWaybill(String useSiteCode,String prefix)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
if(StringUtils.isEmpty(useSiteCode)){
|
|
|
|
|
try {
|
|
|
|
|
useSiteCode= SecurityUtils.getLoginUser().getUser().getOwnerSiteCode();
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String waybillNo = emisElectronicSitePagService.realMatchWaybill(useSiteCode,"T7080");
|
|
|
|
|
return AjaxResult.success("处理成功",waybillNo);
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error(ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取解析地址
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/parseAddress")
|
|
|
|
|
public AjaxResult parseAddress(String content)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
AddressParseResult addressParseResult = emisRegionService.parseAddress(content);
|
2024-12-04 04:38:12 +00:00
|
|
|
if(addressParseResult==null){
|
|
|
|
|
return AjaxResult.error("地址解析失败");
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-12 07:40:42 +00:00
|
|
|
return AjaxResult.success("解析成功",addressParseResult);
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取解析地址
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/getEmpSpecialService")
|
|
|
|
|
public AjaxResult getEmpSpecialService(String empCode)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
// #小程序://探路速运/Nt29PF2JBvBkf2w
|
|
|
|
|
// AddressParseResult addressParseResult = emisRegionService.parseAddress(content);
|
|
|
|
|
return AjaxResult.success("解析成功");
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 预览电子面单打印
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/previewBillPrintImage")
|
|
|
|
|
public AjaxResult previewBillPrintImage(String uuid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
return AjaxResult.success("解析成功");
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取打印模版
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/getTnPrinterLocalPrintTpl")
|
|
|
|
|
public AjaxResult getTnPrinterLocalPrintTpl(String key,String siteCode,String appCode)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
if(!"1070ff852af893f45fb3f8275a5bfb23".equals(key)){
|
|
|
|
|
return AjaxResult.error("非法请求!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EmisPrintTpl queryEmisPrintTpl = new EmisPrintTpl();
|
|
|
|
|
queryEmisPrintTpl.setStatus(1);
|
|
|
|
|
|
|
|
|
|
JSONArray tplList = new JSONArray();
|
|
|
|
|
List<EmisPrintTpl> list=emisPrintTplService.selectPrintTplListByPrinter(queryEmisPrintTpl);
|
|
|
|
|
for (EmisPrintTpl tpl:list) {
|
|
|
|
|
|
|
|
|
|
JSONObject jobjTpl = new JSONObject();
|
|
|
|
|
jobjTpl.put("code",tpl.getCode());
|
|
|
|
|
jobjTpl.put("name",tpl.getName());
|
|
|
|
|
jobjTpl.put("expressType",tpl.getExpressType());
|
|
|
|
|
jobjTpl.put("tplEncData",tpl.getTplEncData());
|
|
|
|
|
|
|
|
|
|
tplList.add(jobjTpl);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("获取成功",tplList);
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 对外物流轨迹信息
|
|
|
|
|
* @param appId
|
|
|
|
|
* @param mainNo
|
|
|
|
|
* @param lang
|
|
|
|
|
* @param sign
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/queryTraceInfo")
|
|
|
|
|
public AjaxResult queryTraceInfo(String appId,String mainNo,String lang,String sign)
|
|
|
|
|
{
|
|
|
|
|
if(StringUtils.isAnyEmpty(mainNo,appId,sign)){
|
|
|
|
|
return AjaxResult.error("appId,sign,mainNo required!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!"xdadan20240614".equals(appId)){
|
|
|
|
|
return AjaxResult.error("appId error!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Map> rstList = new ArrayList();
|
|
|
|
|
Map<String,Object> rstMap = new HashMap<>();
|
|
|
|
|
rstMap.put("billCode",mainNo);
|
2025-05-08 23:11:38 +00:00
|
|
|
List<Map> stepList=emisTmsScanRecordService.queryWaybillTraceInfo(mainNo,lang,false);
|
2024-07-12 07:40:42 +00:00
|
|
|
rstMap.put("steps",stepList);
|
|
|
|
|
rstList.add(rstMap);
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("成功",rstList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-07-31 14:21:40 +00:00
|
|
|
/**
|
|
|
|
|
* 查询任一单号
|
|
|
|
|
* @param appId
|
|
|
|
|
* @param mainNo
|
|
|
|
|
* @param lang
|
|
|
|
|
* @param sign
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/queryTraceInfoAny")
|
|
|
|
|
public AjaxResult queryTraceInfoAny(String appId,String mainNo,String lang,String sign)
|
|
|
|
|
{
|
|
|
|
|
if(StringUtils.isAnyEmpty(mainNo,appId,sign)){
|
|
|
|
|
return AjaxResult.error("appId,sign,mainNo required!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!"xdadan20240614".equals(appId)){
|
|
|
|
|
return AjaxResult.error("appId error!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Map> rstList = new ArrayList();
|
|
|
|
|
Map<String,Object> rstMap = new HashMap<>();
|
|
|
|
|
rstMap.put("billCode",mainNo);
|
2025-05-08 23:12:43 +00:00
|
|
|
List<Map> stepList=emisTmsScanRecordService.queryWaybillTraceInfo(mainNo,lang,false);
|
2024-07-31 14:21:40 +00:00
|
|
|
rstMap.put("steps",stepList);
|
|
|
|
|
rstList.add(rstMap);
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("成功",rstList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-07-12 07:40:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|