This commit is contained in:
linfso 2024-06-17 05:10:16 +08:00
parent 08214e2afa
commit 99eeedf40c
3 changed files with 139 additions and 49 deletions

View File

@ -131,6 +131,9 @@ public class EmisBaseService {
@Autowired
private EmisSiteBillControlMapper emisSiteBillControlMapper;
@Autowired
private EmisSmsSendRecordMapper emisSmsSendRecordMapper;
/**
* 获取客户完整手机号 国家+电话 eg: 0086-1381861188
@ -275,6 +278,20 @@ public class EmisBaseService {
}
/**
* 发送短息
* @param emisSmsSendRecord
*/
public void sendBizSmsMessage(EmisSmsSendRecord emisSmsSendRecord ){
// 检查是否唯一
int rst=emisSmsSendRecordMapper.checkUnique(emisSmsSendRecord);
if(rst==0) {
emisSmsSendRecordMapper.insertEmisSmsSendRecord(emisSmsSendRecord);
}
}
/**
* 获取网点结算账户信息
* @param siteCode

View File

@ -19,8 +19,10 @@ import com.xdadan.erp.common.core.domain.entity.SysUser;
import com.xdadan.erp.common.utils.DateUtils;
import com.xdadan.erp.common.utils.DictUtils;
import com.xdadan.erp.emis.domain.*;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.enumtype.ScanType;
import com.xdadan.erp.emis.domain.enumtype.WaybillAttachType;
import com.xdadan.erp.emis.domain.enumtype.WaybillStatus;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.stat.ScanStatDataInfo;
import com.xdadan.erp.emis.domain.vo.scan.ScanInfo;
@ -160,8 +162,11 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// 开始检查数据
String[] billCodeArr = billCodeInStr.split(",");
for (String billCode:billCodeArr) {
// 返回结果 // 原始数据返回
ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCode);
scanResultItem.getData().putAll(scanDataItem);
// 检查
EmisWaybill emisWaybill = getWaybillByBillCode(billCode);
@ -173,7 +178,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
}
// 已签收不允许扫描
if(ScanType.SIGNED.opCode.equals(emisWaybill.getWaybillStatus())){
if("1".equals(emisWaybill.getBlSign())){
scanResultItem.setResult("fail");
scanResultItem.setMessage("已签收");
itemList.add(scanResultItem);
@ -191,6 +196,11 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
continue;
}
// 返回数据
scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight());
scanResultItem.getData().put("totalVolume",emisWaybill.getTotalVolume());
scanResultItem.getData().put("parcelQty",emisWaybill.getParcelQty());
scanResultItem.setResult("success");
scanResultItem.setMessage("允许操作");
@ -287,7 +297,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
}
// 已签收不允许扫描
if(ScanType.SIGNED.opCode.equals(emisWaybill.getWaybillStatus())){
if("1".equals(emisWaybill.getBlSign())){
scanResultItem.setResult("fail");
scanResultItem.setMessage("已签收");
itemList.add(scanResultItem);
@ -314,28 +324,38 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
emisTmsScanRecord.setScanDate(scanDate);
// 填充特殊数据
this.fillScanDataByScanType(emisTmsScanRecord,scanType,scanDataItem);
try {
this.fillScanDataByScanType(emisTmsScanRecord,scanType,scanDataItem);
// 返回数据
scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight());
scanResultItem.getData().put("totalVolume",emisWaybill.getTotalVolume());
scanResultItem.getData().put("parcelQty",emisWaybill.getParcelQty());
// 返回数据
scanResultItem.getData().put("billWeight",emisWaybill.getBillWeight());
scanResultItem.getData().put("totalVolume",emisWaybill.getTotalVolume());
scanResultItem.getData().put("parcelQty",emisWaybill.getParcelQty());
emisTmsScanRecordMapper.insertEmisTmsScanRecord(emisTmsScanRecord);
emisTmsScanRecordMapper.insertEmisTmsScanRecord(emisTmsScanRecord);
// 修改运单状态
this.changeWaybillStatus(billCode,scanType);
scanResultItem.setResult("success");
scanResultItem.setMessage("操作成功");
itemList.add(scanResultItem);
} catch (EmisBizError emisBizError) {
emisBizError.printStackTrace();
scanResultItem.setResult("fail");
scanResultItem.setMessage(emisBizError.getMessage());
itemList.add(scanResultItem);
}
// 修改运单状态
this.changeWaybillStatus(billCode,scanType);
scanResultItem.setResult("success");
scanResultItem.setMessage("操作成功");
itemList.add(scanResultItem);
}
return itemList;
}
public void fillScanDataByScanType(EmisTmsScanRecord emisTmsScanRecord, String scanType, Map<String,Object> scanDataItem){
public void fillScanDataByScanType(EmisTmsScanRecord emisTmsScanRecord, String scanType, Map<String,Object> scanDataItem) throws EmisBizError {
// 揽收扫描
if(ScanType.GOT.opCode.equals(scanType)){
@ -373,18 +393,62 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// 下一站
// String scanWeightStr = (String)scanDataItem.get("scanWeight");
String preOrNextStationCode = (String)scanDataItem.get("preOrNextStationCode");
if(!StringUtils.isEmpty(preOrNextStationCode)) {
EmisSite site=getSiteByCode(preOrNextStationCode);
emisTmsScanRecord.setPreOrNextStationCode(preOrNextStationCode);
emisTmsScanRecord.setPreOrNextStation(site.getSiteName());
emisTmsScanRecord.setPreOrNextStationPhone(site.getPhone());
// 当前站点
changeWaybillCurrentSite(emisTmsScanRecord.getBillCode(),emisTmsScanRecord.getScanSiteCode());
// 下一站点
changeWaybillNextSite(emisTmsScanRecord.getBillCode(),preOrNextStationCode);
if(StringUtils.isEmpty(preOrNextStationCode)) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"下一站必填");
}
EmisSite site=getSiteByCode(preOrNextStationCode);
emisTmsScanRecord.setPreOrNextStationCode(preOrNextStationCode);
emisTmsScanRecord.setPreOrNextStation(site.getSiteName());
emisTmsScanRecord.setPreOrNextStationPhone(site.getPhone());
// 当前站点
changeWaybillCurrentSite(emisTmsScanRecord.getBillCode(),emisTmsScanRecord.getScanSiteCode());
// 下一站点
changeWaybillNextSite(emisTmsScanRecord.getBillCode(),preOrNextStationCode);
// 判断是否需要发寄件短信
String billCode=emisTmsScanRecord.getBillCode();
boolean isSubBill=false;
// 判断是否是子单
String mainBillCode = "";
String subBillSuffix = "";
if(billCode.startsWith("T7080") && billCode.length()>14 ){
isSubBill = true;
mainBillCode=billCode.substring(0,14);
subBillSuffix=billCode.substring(14);
}else{
mainBillCode=billCode;
}
EmisWaybill waybill=getWaybillByBillCode(emisTmsScanRecord.getBillCode());
if( "1".equals(waybill.getBlMessage()) ) {
//发送寄件短信
String content="尊敬的客户:您寄往${Nationalcity}的包裹已寄出,运单号${name}。如有疑问,详询服务热线4000257080,感谢您使用探路速运!";
String nationalcity=waybill.getReceiveCountryName()+""+waybill.getReceiveProvinceName();
content = content.replace("${Nationalcity}",nationalcity);
content = content.replace("${name}",mainBillCode);
EmisSmsSendRecord emisSmsSendRecord = new EmisSmsSendRecord();
emisSmsSendRecord.setBillCode(emisTmsScanRecord.getBillCode());
emisSmsSendRecord.setSmsType("1"); // 发件短信
emisSmsSendRecord.setPhone(waybill.getReceiveMobile());
emisSmsSendRecord.setContent(content);
emisSmsSendRecord.setSendSiteCode(emisTmsScanRecord.getScanSiteCode());
emisSmsSendRecord.setSendSiteName(emisTmsScanRecord.getScanSite());
emisSmsSendRecord.setSendManCode(emisTmsScanRecord.getScanManCode());
emisSmsSendRecord.setSendManName(emisTmsScanRecord.getScanMan());
sendBizSmsMessage(emisSmsSendRecord);
}
}
// 到件扫描
else if(ScanType.ARRIVAL.opCode.equals(scanType)){
@ -407,12 +471,13 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// 派送员
// "dispatchOrSendManCode": "25001108",
String dispatchOrSendManCode = (String)scanDataItem.get("dispatchOrSendManCode");
if(!StringUtils.isEmpty(dispatchOrSendManCode)) {
emisTmsScanRecord.setDispatchOrSendManCode(dispatchOrSendManCode);
}else{
emisTmsScanRecord.setDispatchOrSendManCode(getCurrentUser().getEmpCode());
if(StringUtils.isEmpty(dispatchOrSendManCode)) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"派送员必填");
}
emisTmsScanRecord.setDispatchOrSendManCode(dispatchOrSendManCode);
SysUser emUser=getEmisStaffByCode(emisTmsScanRecord.getDispatchOrSendManCode());
if(emUser!=null){
emisTmsScanRecord.setDispatchOrSendMan(emUser.getEmpName());
@ -441,10 +506,18 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
String signMan = (String)scanDataItem.get("signMan");
String picUrl = (String)scanDataItem.get("picUrl");
String remark = (String)scanDataItem.get("remark");
if(StringUtils.isEmpty(signMan)) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"签收人必填");
}
emisTmsScanRecord.setSignMan(signMan);
emisTmsScanRecord.setSignDate(emisTmsScanRecord.getScanDate());
emisTmsScanRecord.setPicUrl(picUrl);
// 签收站点
emisTmsScanRecord.setSignSite(getCurrentUser().getOwnerSiteName());
emisTmsScanRecord.setSignSiteCode(getCurrentUser().getOwnerSiteCode());
@ -592,6 +665,17 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// "scanWeight": "0.2"
String packNo = (String)scanDataItem.get("bagNo");
if(StringUtils.isEmpty(packNo)) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"合包号不能为空");
}
// 只允许扫子单
boolean isMainBill=checkWaybillIsExists(emisTmsScanRecord.getBillCode());
if(isMainBill){
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"非子单号,不允许扫描!");
}
emisTmsScanRecord.setBagNo(packNo);
// 更新合包运单扫描状态
@ -632,9 +716,20 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
// "scanDate": "2024-05-02 12:03:05",
// "remark": "",
// "scanWeight": "0.2"
if(scanDataItem.get("carNo")==null) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"车牌号不能为空");
}
String carNo = (String)scanDataItem.get("carNo");
String remark = (String)scanDataItem.get("remark");
if(scanDataItem.get("preOrNextStationCode")==null) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"下一站不能为空");
}
String preOrNextStationCode = (String)scanDataItem.get("preOrNextStationCode");
emisTmsScanRecord.setCarNo(carNo);
emisTmsScanRecord.setRemark(remark);
emisTmsScanRecord.setPreOrNextStationCode(preOrNextStationCode);

View File

@ -95,31 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkUnique" parameterType="EmisSmsSendRecord" resultType="int">
select count(1) from emis_sms_send_record
where del_flag='0'
and id = #{id}
and bill_code = #{billCode}
and send_site_code = #{sendSiteCode}
and send_site_name = #{sendSiteName}
and send_man_name = #{sendManName}
and send_man_code = #{sendManCode}
and sms_type = #{smsType}
and phone = #{phone}
and content = #{content}
and fee = #{fee}
and sms_channel = #{smsChannel}
and send_date = #{sendDate}
and send_status = #{sendStatus}
and err_code = #{errCode}
and err_msg = #{errMsg}
and task_date = #{taskDate}
and remark = #{remark}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>