This commit is contained in:
linfso 2024-07-15 06:20:09 +08:00
parent 992151fc25
commit 6502cf42dd
15 changed files with 11 additions and 1267 deletions

View File

@ -40,8 +40,6 @@ public class Oms2cCommonController extends BaseController
@Autowired
private IEmisRegionService emisRegionService;
@Autowired
private EmisBaseService emisBaseService;
@Autowired
private IEmisPrintTplService emisPrintTplService;
@ -62,12 +60,7 @@ public class Oms2cCommonController extends BaseController
@RequestMapping(value = "/realMatchWaybill")
public AjaxResult realMatchWaybill(String useSiteCode,String prefix)
{
try {
return this.iRpcCommonSvc.realMatchWaybill(useSiteCode,"T7080");
}catch (Exception ex){
ex.printStackTrace();
return AjaxResult.error(ex.getMessage());
}
return this.iRpcCommonSvc.realMatchWaybill(useSiteCode,"T7080");
}
@ -97,18 +90,7 @@ public class Oms2cCommonController extends BaseController
@RequestMapping(value = "/parseAddress")
public AjaxResult parseAddress(String content)
{
try {
AddressParseResult addressParseResult = emisRegionService.parseAddress(content);
return AjaxResult.success("解析成功",addressParseResult);
}catch (Exception ex){
ex.printStackTrace();
// 返回子定义异常
if(ex instanceof EmisBizError){
return AjaxResult.error("("+((EmisBizError)ex).getErrorCode()+")"+ex.getMessage());
}
return AjaxResult.error("服务器异常,联系客服");
}
return this.iRpcCommonSvc.parseAddress(content);
}

View File

@ -17,7 +17,6 @@ import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.common.core.page.TableDataInfo;
import com.xdadan.erp.oms.system.domain.SysNotice;
import com.xdadan.erp.oms.system.service.ISysNoticeService;
import com.xdadan.erp.oms.service.EmisBaseService;
import com.xdadan.erp.oms.service.IEmisWaybillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -44,9 +43,6 @@ public class Oms2cCommonToolsController extends BaseController
@Autowired
private IEmisWaybillService emisWaybillService;
@Autowired
private EmisBaseService emisBaseService;
/**
* 获取app首页统计

View File

@ -1,64 +0,0 @@
/**
* @Project: emis
* @Title: EmisCustomerAccountController.java
* @author linfso
* @date 2024-04-24 05:05:21
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 快递用户结算账户 控制器 </p>
*/
package com.xdadan.erp.oms.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.xdadan.erp.oms.common.core.controller.BaseController;
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.common.core.page.TableDataInfo;
import com.xdadan.erp.oms.domain.EmisCustomerAccount;
import com.xdadan.erp.oms.service.IEmisCustomerAccountService;
/**
* 快递用户结算账户Controller
*
* @author linfso
* @date 2024-04-24 05:05:21
*/
@RestController
@RequestMapping("/oms2c/emisCustomerAccount")
public class Oms2cCustomerAccountController extends BaseController
{
@Autowired
private IEmisCustomerAccountService emisCustomerAccountService;
/**
* 查询快递用户结算账户列表
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerAccount:list')")
@GetMapping("/list")
public TableDataInfo list(EmisCustomerAccount emisCustomerAccount)
{
startPage();
List<EmisCustomerAccount> list = emisCustomerAccountService.selectEmisCustomerAccountList(emisCustomerAccount);
return getDataTable(list);
}
/**
* 获取快递用户结算账户详细信息
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerAccount:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(emisCustomerAccountService.selectEmisCustomerAccountById(id));
}
}

View File

@ -59,18 +59,7 @@ public class Oms2cCustomerSettleBillController extends BaseController
return getDataTable(list);
}
/**
* 导出快递用户结算账单列表
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerSettleBill:export')")
@Log(title = "快递用户结算账单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmisCustomerSettleBill emisCustomerSettleBill)
{
List<EmisCustomerSettleBill> list = emisCustomerSettleBillService.selectEmisCustomerSettleBillList(emisCustomerSettleBill);
ExcelUtil<EmisCustomerSettleBill> util = new ExcelUtil<EmisCustomerSettleBill>(EmisCustomerSettleBill.class);
util.exportExcel(response, list, "快递用户结算账单数据");
}
/**
* 获取快递用户结算账单详细信息
@ -82,36 +71,5 @@ public class Oms2cCustomerSettleBillController extends BaseController
return AjaxResult.success(emisCustomerSettleBillService.selectEmisCustomerSettleBillById(id));
}
/**
* 新增快递用户结算账单
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerSettleBill:add')")
@Log(title = "快递用户结算账单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmisCustomerSettleBill emisCustomerSettleBill)
{
return toAjax(emisCustomerSettleBillService.insertEmisCustomerSettleBill(emisCustomerSettleBill));
}
/**
* 修改快递用户结算账单
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerSettleBill:edit')")
@Log(title = "快递用户结算账单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmisCustomerSettleBill emisCustomerSettleBill)
{
return toAjax(emisCustomerSettleBillService.updateEmisCustomerSettleBill(emisCustomerSettleBill));
}
/**
* 删除快递用户结算账单
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerSettleBill:remove')")
@Log(title = "快递用户结算账单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(emisCustomerSettleBillService.deleteEmisCustomerSettleBillByIds(ids));
}
}

View File

@ -14,7 +14,6 @@ package com.xdadan.erp.oms.web;
import java.util.List;
import com.xdadan.erp.oms.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.oms.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
@ -42,9 +41,6 @@ public class Oms2cTransLineController extends BaseController
@Autowired
private IEmisTransLineService emisTransLineService;
@Autowired
private EmisBaseService emisBaseService;
/**
* 查询线路列表
*/

View File

@ -62,7 +62,6 @@ public class Oms2cTransProductController extends BaseController
}
/**
* 获取运输产品类型详细信息
*/

View File

@ -51,9 +51,6 @@ public class Oms2cWaybillController extends BaseController
@Autowired
private IEmisWaybillService emisWaybillService;
@Autowired
private EmisBaseService emisBaseService;
@Autowired
private IEmisTmsScanRecordService emisTmsScanRecordService;

View File

@ -1,749 +0,0 @@
/**
* @Project: emis
* @Title: EmisWaybillServiceImpl.java
* @author linfso
* @date 2024-02-29 08:15:14
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 运单列表 实体类 </p>
*/
package com.xdadan.erp.oms.service;
import com.xdadan.erp.oms.common.core.domain.entity.SysOmsUser;
import com.xdadan.erp.oms.common.utils.DateUtils;
import com.xdadan.erp.oms.common.utils.DictUtils;
import com.xdadan.erp.oms.common.utils.SecurityUtils;
import com.xdadan.erp.oms.system.mapper.SysOmsUserMapper;
import com.xdadan.erp.oms.domain.*;
import com.xdadan.erp.oms.domain.enumtype.PaymentStatus;
import com.xdadan.erp.oms.domain.enumtype.ScanType;
import com.xdadan.erp.oms.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
/**
* 运单列表Service业务层处理
*
* @author linfso
* @date 2024-02-29 08:15:14
*/
@Service
@Slf4j
public class EmisBaseService {
@Autowired
protected EmisWaybillMapper emisWaybillMapper;
@Autowired
protected IEmisWaybillFeeitemService emisWaybillFeeitemMapper;
@Autowired
protected IEmisWaybillCargoService emisWaybillCargoMapper;
@Autowired
protected IEmisWaybillAttachmentService emisWaybillAttachmentMapper;
@Autowired
protected EmisTransLineMapper emisTransLineMapper;
@Autowired
protected EmisTransProductMapper emisTransProductMapper;
@Autowired
protected EmisNotCalcAgingMapper emisNotCalcAgingMapper;
@Autowired
protected SysOmsUserMapper sysOmsUserMapper;
@Autowired
protected EmisCustomerAddressMapper emisCustomerAddressMapper;
@Autowired
protected EmisTmsScanRecordMapper emisTmsScanRecordMapper;
@Autowired
private EmisProblemTypeMapper emisProblemTypeMapper;
@Autowired
private EmisSiteMapper emisSiteMapper;
@Autowired
private EmisRegionMapper emisRegionMapper;
@Autowired
private EmisDestinationMapper emisDestinationMapper;
/**
* 获取客户完整手机号 国家+电话 eg: 0086-1381861188
* @param countryCode
* @param phone
* @return
*/
public String getCompletePhone(String countryCode,String phone){
if(StringUtils.isAnyEmpty(phone,countryCode) ){
return phone;
}
phone = phone.trim(); //去除头尾空白符
if(StringUtils.isEmpty(phone)){
return "";
}
String str2 = "";
for(int i = 0;i < phone.length();i++) {
//对字符串的每个字符进行处理,如果在0-9之间就追加到str2上
if(phone.charAt(i) >= 48 && phone.charAt(i) <= 57) {
str2 += phone.charAt(i);
}
}
// 去除左边的0
// countryCode = countryCode.replaceAll("^(0+)", "");
phone = phone.replaceAll("^(0+)", "");
return countryCode+"-"+phone;
}
/**
* 获取当前登录用户
* @return
*/
public SysOmsUser getCurrentUser(){
return SecurityUtils.getLoginUser().getUser();
}
/**
* 根据员工获取编号获取统计统计数据
* @param empNo
* @return
*/
public List<Map> selectWaybillStatByEmpCode(String empNo){
if(StringUtils.isEmpty(empNo)){
return null;
}
return emisWaybillMapper.selectWaybillStatByEmpCode(empNo,null);
}
/**
* 获取员工提成信息
* @param empNo
* @return
*/
public List<Map> getCommissionStatByEmpCode(String empNo){
if(StringUtils.isEmpty(empNo)){
return null;
}
return emisWaybillMapper.selectCommissionStatDataByEmp(empNo);
}
/**
* 获取目的地信息
* @param destCode
* @return
*/
public EmisDestination getDestinationByCode(String destCode){
if(StringUtils.isEmpty(destCode)){
return null;
}
EmisDestination queryEmisDestination = new EmisDestination();
queryEmisDestination.setDestCode(destCode);
List<EmisDestination> list=emisDestinationMapper.selectEmisDestinationList(queryEmisDestination);
if(list!=null){
return list.get(0);
}
return null;
}
/**
* 获取跟踪信息
* @param scanRecord
* @return
*/
public String cvtScanRecordToTraceStr(EmisTmsScanRecord scanRecord,boolean isInner){
String content = null;
if(scanRecord==null)
{
return null;
}
String scanType=scanRecord.getScanType();
// content = scanSite ;
// if(opCode.contains("收件")) {
// content=content+" 快件已揽收 ,业务员:"+scanMan;
// }
// else if(opCode.contains("到达") || opCode.contains("到件")) {
// content=content+"快件已到达"+scanSite;
// }
// else if(opCode.contains("发件") ) {
// content=content+"快件已离开"+scanSite +" 发往 "+preOrNextStation;
// }
// else if(opCode.contains("派件扫描") ) {
// content=content+"派件扫描,派件员:"+scanMan;
// }
// else if(opCode.contains("派件") ) {
// content=content+"派件中,派件员:"+scanMan;
// }
// else if(opCode.contains("签收") ) {
// content=content+"已签收,签收人:"+scanMan;
// }
// else {
// content=content+""+opCode;
// }
// 揽收扫描
if(ScanType.GOT.opCode.equals(scanType)){
content="已揽收 快件在【"+scanRecord.getScanSite()+"】已收件,取件员【"+scanRecord.getDispatchOrSendMan()+"】";
if(isInner){
// 南通,丁诗涵,收件,2024-05-23 13:08:15,快件在[南通]已做收件扫描,收件员是[薛明聪]
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",收件,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 发件扫描
else if(ScanType.DEPARTURE.opCode.equals(scanType)){
content="发件 快件已离开【"+scanRecord.getScanSite() +"】 下站发往【"+scanRecord.getPreOrNextStation()+"】";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",发件,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 到件扫描
else if(ScanType.ARRIVAL.opCode.equals(scanType)){
content="到件 快件已到达【"+scanRecord.getScanSite()+"】";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",到件,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 派送扫描
else if(ScanType.SENT.opCode.equals(scanType)){
content="派件 快件在【"+scanRecord.getScanSite()+"】开始派送,已分配派件员【"+scanRecord.getDispatchOrSendMan()+"】";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",派件,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 签收扫描
else if(ScanType.SIGNED.opCode.equals(scanType)){
content="签收 快件在【"+scanRecord.getScanSite()+"】,签收人["+scanRecord.getSignMan()+"]";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",签收,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 留仓
else if(ScanType.HOLD.opCode.equals(scanType)){
content="留仓 快件在【"+scanRecord.getScanSite()+"】已留仓";
}
// 转单扫描
else if(ScanType.TRANSFER.opCode.equals(scanType)){
EmisWaybill waybill = getWaybillByBillCode(scanRecord.getBillCode());
String transferCompanyName=DictUtils.getDictLabel("emis_express_code",waybill.getTransferCode());
content="转三方快递 ["+transferCompanyName+":"+waybill.getTransferBillcode()+"]...";
// 查询转单轨迹
// 拼接三方公司物流轨迹
}
// 问题件
else if(ScanType.ISSUE.opCode.equals(scanType)){
EmisWaybill waybill = getWaybillByBillCode(scanRecord.getBillCode());
content="问题件 "+waybill.getProblemTypeName()+"("+waybill.getProblemCause()+")";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",问题件,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 合包
else if(ScanType.CO_PACKING.opCode.equals(scanType)){
}
else if(ScanType.UN_PACKING.opCode.equals(scanType)){
}
// 装车
else if(ScanType.LOADING.opCode.equals(scanType)){
}
// 卸车
else if(ScanType.UN_LOADING.opCode.equals(scanType)){
}
// 报关扫描
else if(ScanType.DECLEARE.opCode.equals(scanType)){
content="报关扫描 快件已报关,下站发往【"+scanRecord.getPreOrNextStation()+"】";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",报关扫描,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
// 清关扫描
else if(ScanType.CLEARANCE.opCode.equals(scanType)){
content="清关扫描 快件已清关,下站发往【"+scanRecord.getPreOrNextStation()+"】";
if(isInner){
content=scanRecord.getScanSite()+","+scanRecord.getScanMan()+",清关扫描,"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate())+","+content;
}
}
return content;
}
/**
* 根据billCode 获取单号信息
* @param billCode
* @return
*/
public EmisWaybill getWaybillByBillCode(String billCode){
if(StringUtils.isEmpty(billCode)){
return null;
}
return emisWaybillMapper.selectEmisWaybillByBillCode(billCode);
}
public EmisProblemType getEmisProblemTypebyTypeId(Integer typeId){
return emisProblemTypeMapper.selectEmisProblemTypeById(typeId);
}
/**
* 根据客户编号,获取客户信息
* @param customerCode
* @return
*/
public SysOmsUser getCustomerUserByCode(String customerCode){
SysOmsUser querySysOmsUser = new SysOmsUser();
querySysOmsUser.setCustomerCode(customerCode);
List<SysOmsUser> list=sysOmsUserMapper.selectSysOmsUserList(querySysOmsUser);
if(CollectionUtils.isEmpty(list)){
return null;
}
return list.get(0);
}
/**
* 根据手机号获取客户信息
* @param phone
* @return
*/
public SysOmsUser getCustomerUserByPhone(String phone){
return sysOmsUserMapper.selectUserByPhoneNumber(phone);
}
/**
* 根据月结编号获取客户信息
* @param monthlyPayCode
* @return
*/
public SysOmsUser getCustomerUserByMonthlyPayCode(String monthlyPayCode){
SysOmsUser querySysOmsUser = new SysOmsUser();
querySysOmsUser.setMonthlyPayCode(monthlyPayCode);
List<SysOmsUser> list=sysOmsUserMapper.selectSysOmsUserList(querySysOmsUser);
if(CollectionUtils.isEmpty(list)){
return null;
}
return list.get(0);
}
/**
* 获取问题件类型
* @param problemType
* @return
*/
public EmisProblemType getEmisProblemTypeByType(Integer problemType){
return emisProblemTypeMapper.selectEmisProblemTypeById(problemType);
}
public EmisRegion getRegionByName(String name,Integer regionType ){
EmisRegion queryRegion = new EmisRegion();
queryRegion.setRegionName(name);
queryRegion.setRegionType(regionType);
List<EmisRegion> list=emisRegionMapper.selectEmisRegionList(queryRegion);
if(!CollectionUtils.isEmpty(list)){
return list.get(0);
}
return null;
}
public EmisRegion getRegionByCode(String code){
EmisRegion queryRegion = new EmisRegion();
queryRegion.setRegionCode(code);
List<EmisRegion> list=emisRegionMapper.selectEmisRegionList(queryRegion);
if(!CollectionUtils.isEmpty(list)){
return list.get(0);
}
return null;
}
public EmisSite getSiteByCode(String siteCode){
EmisSite querySite = new EmisSite();
querySite.setSiteCode(siteCode);
List<EmisSite> siteList=emisSiteMapper.selectEmisSiteList(querySite);
if(!CollectionUtils.isEmpty(siteList)){
return siteList.get(0);
}
return null;
}
/**
* 产生客户编码 规则: siteCode+ 000000
* @param siteCode
* @return
*/
private String genCustomerCode(String siteCode){
Long maxCode=sysOmsUserMapper.selectMaxCustomerCodeBySite(siteCode);
return maxCode.toString();
}
/**
* 创建客户
* @param SysOmsUser
* @return
*/
public SysOmsUser createCustomerUser(SysOmsUser SysOmsUser) {
// 直接返回客户
if(SysOmsUser.getCustomerCode() != null){
return SysOmsUser;
}
SysOmsUser oldUser=getCustomerUserByPhone(SysOmsUser.getPhone());
if(oldUser!=null){
if(oldUser.getCustomerCode() == null){
// 产生 customerCode
String siteCode = oldUser.getOwnerSite();
if(StringUtils.isEmpty(siteCode)){
siteCode="88888";
}
// 根据所属网点获取客户编码
String customerCode=genCustomerCode(siteCode);
oldUser.setCustomerCode(customerCode);
// oldUser.preUpdate();
sysOmsUserMapper.updateSysOmsUser(oldUser);
}
return oldUser;
}
// 产生 customerCode
String siteCode = SysOmsUser.getOwnerSite();
if(StringUtils.isEmpty(siteCode)){
siteCode="88888";
}
// 根据所属网点获取客户编码
String customerCode=genCustomerCode(siteCode);
// 插入现金客户数据
SysOmsUser.setCustomerCode(customerCode);
SysOmsUser.setOwnerSite(siteCode);
SysOmsUser.setUserName(SysOmsUser.getCustomerCode());
sysOmsUserMapper.insertSysOmsUser(SysOmsUser);
return SysOmsUser;
}
/**
* 根据添加的地址增加客户
* @param emisCustomerAddressNew
* @return
*/
public int createCustomerAddress(EmisCustomerAddress emisCustomerAddressNew){
int cnt=emisCustomerAddressMapper.checkUnique(emisCustomerAddressNew);
if(cnt==0){
// 不重复的情况则 创建地址
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew);
}else{
// 重复则只修改,不增加
EmisCustomerAddress queryObj=new EmisCustomerAddress();
queryObj.setCounty(emisCustomerAddressNew.getCounty());
queryObj.setName(emisCustomerAddressNew.getName());
queryObj.setPhone(emisCustomerAddressNew.getPhone());
queryObj.setProvince(emisCustomerAddressNew.getProvince());
queryObj.setCity(emisCustomerAddressNew.getCity());
queryObj.setCounty(emisCustomerAddressNew.getCounty());
queryObj.setAddressType(emisCustomerAddressNew.getAddressType());
queryObj.setAddress(emisCustomerAddressNew.getAddress());
queryObj.setCompany(emisCustomerAddressNew.getCompany());
List<EmisCustomerAddress> existList=emisCustomerAddressMapper.selectExistAddressList(queryObj);
// 重复数据需要修正地址的客户归属
if(existList!=null){
for (EmisCustomerAddress cusddress:existList) {
if(StringUtils.isEmpty(cusddress.getCustomerCode())){
// 增加使用站点
String useSiteCode = emisCustomerAddressNew.getUseSiteCode();
if(useSiteCode.indexOf(emisCustomerAddressNew.getUseSiteCode())==-1){
cusddress.setUseSiteCode(useSiteCode+","+emisCustomerAddressNew.getUseSiteCode());
}
cusddress.setCustomerCode(emisCustomerAddressNew.getCustomerCode());
emisCustomerAddressMapper.updateAddessCustomerCodeAndUseSite(cusddress);
}
}
}
}
return 1;
}
/**
* 获取线路
* @param code
* @return
*/
public EmisTransLine getTransLineByCode(String code) {
EmisTransLine queryEmisTransLine = new EmisTransLine();
queryEmisTransLine.setLineCode(code);
List<EmisTransLine> list=emisTransLineMapper.selectEmisTransLineList(queryEmisTransLine);
if(!CollectionUtils.isEmpty(list)) {
return list.get(0);
}
return null;
}
/**
* 获取产品
* @param code
* @return
*/
public EmisTransProduct getTransProductByCode(String code) {
EmisTransProduct emisTransProduct = new EmisTransProduct();
emisTransProduct.setProdCode(code);
List<EmisTransProduct> list=emisTransProductMapper.selectEmisTransProductList(emisTransProduct);
if(!CollectionUtils.isEmpty(list)) {
return list.get(0);
}
return null;
}
/**
* 获取产品列表 通过线路代码
* @param lineCode
* @return
*/
public List<EmisTransProduct> getTransProductByTransLine(String lineCode) {
EmisTransProduct emisTransProduct = new EmisTransProduct();
emisTransProduct.setTransLineCode(lineCode);
return emisTransProductMapper.selectEmisTransProductList(emisTransProduct);
}
/**
* 判断是否超时锁账
* @param emisWaybill
* @return
*/
public boolean isOutTimeLock(EmisWaybill emisWaybill) {
// 判断运单状态,如果已锁账,则不允许修改
// 下单超过 24小时
// (1)当天开单的,次日9点前允许修改面单;
//(2)当天开单次日上午9点后未锁帐,总部/财务中心修改;
//(3)若运单已签收、已确认账单、已收款、已锁帐,登记申请审批后进行修改;
if("1".equals(emisWaybill.getBlBill())
|| ScanType.SIGNED.opCode.equals(emisWaybill.getWaybillStatus())
|| PaymentStatus.PAID.statusCode.equals(emisWaybill.getPaymentStatus())
|| PaymentStatus.PAID_SOME.statusCode.equals(emisWaybill.getPaymentStatus())
){
return true;
}
// 判断系统是否已锁账
// 创建时间<服务器0点 次日9点锁账
Date createTime = emisWaybill.getCreateTime();
Date now = new Date();
Calendar calendar = Calendar.getInstance();
int todayHour = calendar.get(Calendar.HOUR_OF_DAY);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MILLISECOND, 0);
long todayZero = calendar.getTimeInMillis();
return false;
}
/**
* 计算预估到达时间
* @param sendDate 开单时间
* @param prodCode
* @param receiveCountry
* @param sendCountry
* @return
*/
public Date getEstimateDate(Date sendDate,String prodCode,String receiveCountry,String sendCountry,Integer otherAddDay) {
Date estDate = null;
if(otherAddDay==null){
otherAddDay=0;
}
// 发件时间+1天,从下一天的0点开始算
sendDate = DateUtils.addDays(sendDate,1);
// 初始化0点时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(sendDate);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date startDate=calendar.getTime();
// 获取产品最大时效
EmisTransProduct emisTransProduct = getTransProductByCode(prodCode);
// 预估到达时间 startData+最大时效
Date endDate = DateUtils.addDays(startDate, emisTransProduct.getMaxAging()+otherAddDay-1);
// 计算周末
int weekDays = computeWeekDays(startDate,endDate,true);
// 计算不计较时效的时间
int notCaclDays=emisNotCalcAgingMapper.getNotCalcAgingDays(
receiveCountry,
sendCountry,
startDate,
endDate);
// 1+1+
int totalDays=(emisTransProduct.getMaxAging()+otherAddDay-1)+weekDays+notCaclDays;
log.info("计算预估到达时间:[maxAging="+emisTransProduct.getMaxAging()+",weekDays="+weekDays+",notCaclDays="+notCaclDays);
// 预估达到时间
return DateUtils.addDays(startDate, totalDays);
}
public static int computeWeekDays(Date t1,Date t2,boolean isSingleDayoff){
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTime(t1);
cal2.setTime(t2);
//确定一个 大日期
if(cal1.compareTo(cal2) > 0){
Calendar temp = cal1;
cal1 = cal2;
cal2 = temp;
temp = null;
}
int weekDays = 0;
while(cal1.compareTo(cal2)<=0){
if(cal1.get(
Calendar.DAY_OF_WEEK)==Calendar.SUNDAY
|| ( cal1.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY && !isSingleDayoff)
){
weekDays++;
}
cal1.add(Calendar.DAY_OF_YEAR,1);
}
return weekDays;
}
public static void main(String[] args) {
// Date startDate = new Date();
// Date endDate = DateUtils.addDays(startDate, 10);
// int weekDays = computeWeekDays(startDate,endDate,true);
//// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
//
// System.out.println(startDate);
// System.out.println(endDate);
// String pdfInfo="[南京市场部-越南胡志明][越HCM]";
// pdfInfo=pdfInfo.replace("][","||");
//
// String[] striparr = pdfInfo.split("\\|\\|");
//
// System.out.println(striparr[1]);
// System.out.println(striparr[0]);
// String packageWJC = striparr[1].replace("]", "");
// String package3dm = striparr[0].replace("[", "");
// System.out.println(packageWJC);
// System.out.println(package3dm);
String mainBillCode="T70803005000020002";
// boolean isSubBill=false;
// // 判断是否是子单
// String queryBillCode="";
// if(mainBillCode.startsWith("T7080") && mainBillCode.length()>14 ){
// isSubBill = true;
// queryBillCode=mainBillCode.substring(0,14);
// String subBillSuffix=mainBillCode.substring(14);
// System.out.println(mainBillCode);
// System.out.println(queryBillCode);
// System.out.println(Integer.valueOf(subBillSuffix));
// }
}
}

View File

@ -69,6 +69,5 @@ public interface IEmisRegionService
*/
public int deleteEmisRegionById(Long id);
public AddressParseResult parseAddress(String content) throws EmisBizError;
}

View File

@ -12,7 +12,6 @@ package com.xdadan.erp.oms.service.impl;
import java.util.List;
import com.xdadan.erp.oms.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.oms.domain.EmisCustomerAddress;
@ -26,7 +25,7 @@ import com.xdadan.erp.oms.service.IEmisCustomerAddressService;
* @date 2024-03-01 04:47:51
*/
@Service
public class EmisCustomerAddressServiceImpl extends EmisBaseService implements IEmisCustomerAddressService
public class EmisCustomerAddressServiceImpl implements IEmisCustomerAddressService
{
@Autowired
private EmisCustomerAddressMapper emisCustomerAddressMapper;
@ -68,8 +67,6 @@ public class EmisCustomerAddressServiceImpl extends EmisBaseService implements I
// emisCustomerAddress.preInsert();
// emisCustomerAddress.setUseSiteCode(getCurrentUser().getOwnerSiteCode());
// emisCustomerAddress.setUseSite(getCurrentUser().getOwnerSiteName());
// 创建用户
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddress);
}

View File

@ -1,159 +0,0 @@
/**
* @Project: emis
* @Title: EmisRegionServiceImpl.java
* @author linfso
* @date 2024-04-11 15:05:24
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 四级省市区镇表 实体类 </p>
*/
package com.xdadan.erp.oms.service.impl;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.xdadan.erp.oms.domain.exception.EmisBizError;
import com.xdadan.erp.oms.domain.vo.AddressParseResult;
import com.xdadan.erp.oms.service.EmisBaseService;
import com.xdadan.erp.oms.utils.WaybillHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.oms.domain.EmisRegion;
import com.xdadan.erp.oms.mapper.EmisRegionMapper;
import com.xdadan.erp.oms.service.IEmisRegionService;
/**
* 四级省市区镇表Service业务层处理
*
* @author linfso
* @date 2024-04-11 15:05:24
*/
@Service
public class EmisRegionServiceImpl extends EmisBaseService implements IEmisRegionService
{
@Autowired
private EmisRegionMapper emisRegionMapper;
/**
* 查询四级省市区镇表
*
* @param id 四级省市区镇表主键
* @return 四级省市区镇表
*/
@Override
public EmisRegion selectEmisRegionById(Long id)
{
return emisRegionMapper.selectEmisRegionById(id);
}
/**
* 查询四级省市区镇表列表
*
* @param emisRegion 四级省市区镇表
* @return 四级省市区镇表
*/
@Override
public List<EmisRegion> selectEmisRegionList(EmisRegion emisRegion)
{
return emisRegionMapper.selectEmisRegionList(emisRegion);
}
/**
* 新增四级省市区镇表
*
* @param emisRegion 四级省市区镇表
* @return 结果
*/
@Override
public int insertEmisRegion(EmisRegion emisRegion)
{
return emisRegionMapper.insertEmisRegion(emisRegion);
}
/**
* 修改四级省市区镇表
*
* @param emisRegion 四级省市区镇表
* @return 结果
*/
@Override
public int updateEmisRegion(EmisRegion emisRegion)
{
return emisRegionMapper.updateEmisRegion(emisRegion);
}
/**
* 批量删除四级省市区镇表
*
* @param ids 需要删除的四级省市区镇表主键
* @return 结果
*/
@Override
public int deleteEmisRegionByIds(Long[] ids)
{
return emisRegionMapper.deleteEmisRegionByIds(ids);
}
/**
* 删除四级省市区镇表信息
*
* @param id 四级省市区镇表主键
* @return 结果
*/
@Override
public int deleteEmisRegionById(Long id)
{
return emisRegionMapper.deleteEmisRegionById(id);
}
/**
* 智能解析地址
* @param content
* @return
* @throws EmisBizError
*/
@Override
public AddressParseResult parseAddress(String content) throws EmisBizError {
AddressParseResult addressParseResult= null;
JSONObject rst = WaybillHelper.parseChinaAddress(content);
if(rst!=null){
addressParseResult = new AddressParseResult();
addressParseResult.setAddress(rst.getString("address"));
addressParseResult.setName(rst.getString("name"));
addressParseResult.setPhone(rst.getString("phone"));
String provinceName = rst.getString("province");
String citeName = rst.getString("city");
String countyName = rst.getString("county");
addressParseResult.setProvinceName(provinceName);
addressParseResult.setCityName(citeName);
addressParseResult.setCountyName(countyName);
EmisRegion provinceRegion=getRegionByName(provinceName,1);
if(provinceRegion!=null){
addressParseResult.setProvince(provinceRegion.getRegionCode());
}
EmisRegion cityRegion=getRegionByName(citeName,2);
if(cityRegion!=null){
addressParseResult.setCity(cityRegion.getRegionCode());
}
EmisRegion countyRegion=getRegionByName(countyName,3);
if(countyRegion!=null){
addressParseResult.setCounty(countyRegion.getRegionName());
}
String countryName ="中国";
String country ="0086";
addressParseResult.setCountry(country);
addressParseResult.setCountryName(countryName);
}
return addressParseResult;
}
}

View File

@ -1,140 +0,0 @@
/**
* @Project: emis
* @Title: EmisSiteServiceImpl.java
* @author linfso
* @date 2023-12-14 13:02:46
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 网点 实体类 </p>
*/
package com.xdadan.erp.oms.service.impl;
import java.util.List;
import com.xdadan.erp.oms.domain.EmisDestination;
import com.xdadan.erp.oms.domain.EmisRegion;
import com.xdadan.erp.oms.mapper.EmisDestinationMapper;
import com.xdadan.erp.oms.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.oms.domain.EmisSite;
import com.xdadan.erp.oms.mapper.EmisSiteMapper;
import com.xdadan.erp.oms.service.IEmisSiteService;
import org.springframework.transaction.annotation.Transactional;
/**
* 网点Service业务层处理
*
* @author linfso
* @date 2023-12-14 13:02:46
*/
@Service
public class EmisSiteServiceImpl extends EmisBaseService implements IEmisSiteService
{
@Autowired
private EmisSiteMapper emisSiteMapper;
@Autowired
private EmisDestinationMapper emisDestinationMapper;
/**
* 查询网点
*
* @param id 网点主键
* @return 网点
*/
@Override
public EmisSite selectEmisSiteById(Long id)
{
return emisSiteMapper.selectEmisSiteById(id);
}
/**
* 查询网点列表
*
* @param emisSite 网点
* @return 网点
*/
@Override
public List<EmisSite> selectEmisSiteList(EmisSite emisSite)
{
return emisSiteMapper.selectEmisSiteList(emisSite);
}
/**
* 新增网点
*
* @param emisSite 网点
* @return 结果
*/
@Override
@Transactional
public int insertEmisSite(EmisSite emisSite)
{
// 创建网点
// emisSite.preInsert();
emisSite.setOrderNum(9999);
emisSiteMapper.insertEmisSite(emisSite);
// 自动创建目的地
EmisDestination emisDestination = new EmisDestination();
emisDestination.setDestCode(emisSite.getSiteCode());
emisDestination.setCountry(emisSite.getCountryCode());
emisDestination.setDestName(emisSite.getSiteName());
emisDestination.setDestNameEn(emisSite.getSiteNameEn());
emisDestination.setStatus(1);
emisDestination.setSiteCode(emisSite.getSiteCode());
emisDestination.setProvince(emisSite.getProvince());
emisDestination.setCity(emisSite.getCity());
emisDestination.setCounty(emisSite.getCounty());
EmisRegion emisRegion=getRegionByCode(emisSite.getProvince());
if(emisRegion!=null){
emisDestination.setCountryAreaId(emisRegion.getAreaId());
}
// emisDestination.preInsert();
emisDestinationMapper.insertEmisDestination(emisDestination);
return 1;
}
/**
* 修改网点
*
* @param emisSite 网点
* @return 结果
*/
@Override
public int updateEmisSite(EmisSite emisSite)
{
return emisSiteMapper.updateEmisSite(emisSite);
}
/**
* 批量删除网点
*
* @param ids 需要删除的网点主键
* @return 结果
*/
@Override
public int deleteEmisSiteByIds(Long[] ids)
{
return emisSiteMapper.deleteEmisSiteByIds(ids);
}
/**
* 删除网点信息
*
* @param id 网点主键
* @return 结果
*/
@Override
public int deleteEmisSiteById(Long id)
{
return emisSiteMapper.deleteEmisSiteById(id);
}
}

View File

@ -1,73 +0,0 @@
/**
* @Project: emis
* @Title: EmisTmsScanRecordServiceImpl.java
* @author linfso
* @date 2024-03-01 08:54:59
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> TMS扫描记录 实体类 </p>
*/
package com.xdadan.erp.oms.service.impl;
import java.util.*;
import com.xdadan.erp.oms.common.utils.DateUtils;
import com.xdadan.erp.oms.domain.*;
import com.xdadan.erp.oms.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.oms.mapper.EmisTmsScanRecordMapper;
import com.xdadan.erp.oms.service.IEmisTmsScanRecordService;
/**
* TMS扫描记录Service业务层处理
*
* @author linfso
* @date 2024-03-01 08:54:59
*/
@Service
public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEmisTmsScanRecordService
{
@Autowired
private EmisTmsScanRecordMapper emisTmsScanRecordMapper;
/**
* 获取物流轨迹表
* @param billCode
* @return
*/
@Override
public List<EmisTmsScanRecord> getTraceListByBillCode(String billCode) {
return emisTmsScanRecordMapper.selectTraceListByBillCode(billCode);
}
// 获取物流跟踪列表
@Override
public List<Map> queryWaybillTraceInfo(String billCode,String lang) {
List<Map> stepList = new ArrayList<>();
List<EmisTmsScanRecord> listTraceList= getTraceListByBillCode(billCode);
for(EmisTmsScanRecord scanRecord:listTraceList){
String content=cvtScanRecordToTraceStr(scanRecord,false);
if(content!=null) {
Map<String, Object> step = new HashMap<>();
step.put("time", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate()));
step.put("status",scanRecord.getScanType());
step.put("content", content);
stepList.add(step);
}
}
return stepList;
}
}

View File

@ -18,6 +18,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.googlecode.aviator.AviatorEvaluator;
import com.xdadan.erp.oms.common.core.domain.entity.SysOmsUser;
import com.xdadan.erp.oms.common.utils.DateUtils;
import com.xdadan.erp.oms.common.utils.SecurityUtils;
import com.xdadan.erp.oms.domain.*;
import com.xdadan.erp.oms.domain.exception.EmisBizError;
import com.xdadan.erp.oms.domain.enumtype.EmisBizErrorType;
@ -42,7 +43,7 @@ import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWaybillService
public class EmisWaybillServiceImpl implements IEmisWaybillService
{
@Autowired
private EmisWaybillMapper emisWaybillMapper;
@ -57,7 +58,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
public List<EmisWaybill> selectUserOrderList(EmisWaybill emisWaybill)
{
// 只能获取用户自己的运单
emisWaybill.setCustomerCode(getCurrentUser().getCustomerCode());
emisWaybill.setCustomerCode(SecurityUtils.getLoginUser().getUser().getCustomerCode());
List<EmisWaybill> list=emisWaybillMapper.selectUserOrderList(emisWaybill);
return list;

View File

@ -19,4 +19,7 @@ public interface IRpcCommonSvc {
public AjaxResult realMatchWaybill(@RequestParam("useSiteCode") String useSiteCode, @RequestParam("prefix") String prefix);
@GetMapping(value = "/apiweb/common/parseAddress")
public AjaxResult parseAddress(@RequestParam("content") String content);
}