Merge pull request 'develop' (#176) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/176
This commit is contained in:
heyu 2025-09-04 17:40:55 +08:00
commit 638fcedbf9
3 changed files with 62 additions and 16 deletions

View File

@ -1,11 +1,11 @@
/**
/**
* @Project: emis
* @Title: EmisTmsSiteBatchDtlController.java
* @author linfso
* @date 2024-03-01 06:38:50
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @version v1.0
* @Description: <p> 一级网点TMS组批次明细 控制器 </p>
*/
@ -41,7 +41,7 @@ import com.xdadan.erp.emis.service.IEmisTmsSiteBatchDtlService;
/**
* 一级网点TMS组批次明细Controller
*
*
* @author linfso
* @date 2024-03-01 06:38:50
*/
@ -62,7 +62,7 @@ public class EmisTmsSiteBatchDtlController extends EmisBaseController
startPage();
// 设置通用权限查询参数
setPrivParams(emisTmsSiteBatchDtl);
// setPrivParams(emisTmsSiteBatchDtl);
List<EmisTmsSiteBatchDtl> list = emisTmsSiteBatchDtlService.selectEmisTmsSiteBatchDtlList(emisTmsSiteBatchDtl);
return getDataTable(list);

View File

@ -3561,29 +3561,56 @@ public class EmisBaseService {
public int createCustomerAddressNew(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
checkAdress(emisCustomerAddressNew);
List<EmisCustomerAddress> emisCustomerAddressList = emisCustomerAddressMapper.checkAndQuery(emisCustomerAddressNew);
List<EmisCustomerAddress> emisCustomerAddressList = emisCustomerAddressMapper
.checkAndQuery(emisCustomerAddressNew);
if (CollectionUtil.isEmpty(emisCustomerAddressList)) {
// 不重复的情况则 创建地址
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew);
} else {
if ("1".equals(emisCustomerAddressNew.getAddressType()) && "0086".equals(emisCustomerAddressNew.getCountry())) {
List<Long> emisCustomerAddressIds = emisCustomerAddressList.stream().filter(i -> (!emisCustomerAddressNew.getEnterpriseTaxId().equals(i.getEnterpriseTaxId()) || !emisCustomerAddressNew.getEnterpriseName().equals(i.getEnterpriseName()))).map(EmisCustomerAddress::getId).collect(Collectors.toList());
if ("1".equals(emisCustomerAddressNew.getAddressType())
&& "0086".equals(emisCustomerAddressNew.getCountry())) {
String newEnterpriseTaxId = emisCustomerAddressNew.getEnterpriseTaxId();
String newEnterpriseName = emisCustomerAddressNew.getEnterpriseName();
List<Long> emisCustomerAddressIds = emisCustomerAddressList.stream()
.filter(i -> {
String existingTaxId = i.getEnterpriseTaxId();
String existingName = i.getEnterpriseName();
// 如果新数据为空,则过滤掉企业信息不匹配的记录
if (StringUtil.isBlank(newEnterpriseTaxId) || StringUtil.isBlank(newEnterpriseName)) {
return false;
}
// 如果现有数据为空,则包含在更新列表中
if (StringUtil.isBlank(existingTaxId) || StringUtil.isBlank(existingName)) {
return true;
}
// 比较企业信息是否不匹配
return !newEnterpriseTaxId.equals(existingTaxId) || !newEnterpriseName.equals(existingName);
})
.map(EmisCustomerAddress::getId)
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(emisCustomerAddressIds)) {
return 1;
}
if (emisCustomerAddressNew.getId() != null) {
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
emisCustomerAddress.setId(emisCustomerAddressNew.getId());
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
emisCustomerAddress.setEnterpriseTaxId(newEnterpriseTaxId);
emisCustomerAddress.setEnterpriseName(newEnterpriseName);
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
return 1;
}
for (Long id : emisCustomerAddressIds) {
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
emisCustomerAddress.setId(id);
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
emisCustomerAddress.setEnterpriseTaxId(newEnterpriseTaxId);
emisCustomerAddress.setEnterpriseName(newEnterpriseName);
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
}
}
@ -3595,7 +3622,10 @@ public class EmisBaseService {
public void checkAdress(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
if ("1".equals(emisCustomerAddressNew.getAddressType())) {
if ("0086".equals(emisCustomerAddressNew.getCountry())) {
if (StringUtil.isBlank(emisCustomerAddressNew.getEnterpriseTaxId()) || StringUtil.isBlank(emisCustomerAddressNew.getEnterpriseName())) {
// 检查是否来自OMS
boolean fromOms = "1".equals(emisCustomerAddressNew.getParams().get("fromOms"));
if (!fromOms && (StringUtil.isBlank(emisCustomerAddressNew.getEnterpriseTaxId())
|| StringUtil.isBlank(emisCustomerAddressNew.getEnterpriseName()))) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "企业名称/企业税号不能为空");
}
@ -3643,7 +3673,7 @@ public class EmisBaseService {
*/
public boolean validateEnterpriseName(String enterpriseName) {
if (com.xdadan.erp.common.utils.StringUtils.isEmpty(enterpriseName)) {
return false;
return true;
}
// 检查是否包含不允许的字符
@ -3668,7 +3698,7 @@ public class EmisBaseService {
*/
public boolean validateEnterpriseTaxId(String enterpriseTaxId) {
if (com.xdadan.erp.common.utils.StringUtils.isEmpty(enterpriseTaxId)) {
return false;
return true;
}
// 检查长度
@ -4119,7 +4149,17 @@ public class EmisBaseService {
int totalDays=(emisTransProduct.getMaxAging()+otherAddDay-1)+weekDays+notCaclDays;
log.info("计算预估到达时间:[maxAging="+emisTransProduct.getMaxAging()+",weekDays="+weekDays+",notCaclDays="+notCaclDays);
// 预估达到时间
return DateUtils.addDays(startDate, totalDays);
Date estimateDate = DateUtils.addDays(startDate, totalDays);
// 判断预估到达时间是否为周末,如果是周末则往后加一天
Calendar cal = Calendar.getInstance();
cal.setTime(estimateDate);
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
if (dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) {
estimateDate = DateUtils.addDays(estimateDate, 1);
}
return estimateDate;
}

View File

@ -2166,6 +2166,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
sendAddress.setAddressType("1");
sendAddress.setCustomerCode(customerCode);
sendAddress.setEnterpriseName(emisWaybillSave.getEnterpriseName());
sendAddress.setEnterpriseTaxId(emisWaybillSave.getEnterpriseTaxId());
if (emisWaybillSave.getSendCustomerAddressId() != null) {
sendAddress.setId(Long.valueOf(emisWaybillSave.getSendCustomerAddressId()));
}
// 收件地址
EmisCustomerAddress recieveAddress = new EmisCustomerAddress();
@ -2223,7 +2228,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
// 保存客户收件、寄件地址
createCustomerAddress(sendAddress);
sendAddress.getParams().put("fromOms", "1");
createCustomerAddressNew(sendAddress);
createCustomerAddress(recieveAddress);
// 获取泡重比