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:
commit
638fcedbf9
@ -62,7 +62,7 @@ public class EmisTmsSiteBatchDtlController extends EmisBaseController
|
|||||||
startPage();
|
startPage();
|
||||||
|
|
||||||
// 设置通用权限查询参数
|
// 设置通用权限查询参数
|
||||||
setPrivParams(emisTmsSiteBatchDtl);
|
// setPrivParams(emisTmsSiteBatchDtl);
|
||||||
|
|
||||||
List<EmisTmsSiteBatchDtl> list = emisTmsSiteBatchDtlService.selectEmisTmsSiteBatchDtlList(emisTmsSiteBatchDtl);
|
List<EmisTmsSiteBatchDtl> list = emisTmsSiteBatchDtlService.selectEmisTmsSiteBatchDtlList(emisTmsSiteBatchDtl);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|||||||
@ -3561,29 +3561,56 @@ public class EmisBaseService {
|
|||||||
public int createCustomerAddressNew(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
|
public int createCustomerAddressNew(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
|
||||||
|
|
||||||
checkAdress(emisCustomerAddressNew);
|
checkAdress(emisCustomerAddressNew);
|
||||||
List<EmisCustomerAddress> emisCustomerAddressList = emisCustomerAddressMapper.checkAndQuery(emisCustomerAddressNew);
|
List<EmisCustomerAddress> emisCustomerAddressList = emisCustomerAddressMapper
|
||||||
|
.checkAndQuery(emisCustomerAddressNew);
|
||||||
if (CollectionUtil.isEmpty(emisCustomerAddressList)) {
|
if (CollectionUtil.isEmpty(emisCustomerAddressList)) {
|
||||||
// 不重复的情况则 创建地址
|
// 不重复的情况则 创建地址
|
||||||
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew);
|
return emisCustomerAddressMapper.insertEmisCustomerAddress(emisCustomerAddressNew);
|
||||||
} else {
|
} else {
|
||||||
if ("1".equals(emisCustomerAddressNew.getAddressType()) && "0086".equals(emisCustomerAddressNew.getCountry())) {
|
if ("1".equals(emisCustomerAddressNew.getAddressType())
|
||||||
List<Long> emisCustomerAddressIds = emisCustomerAddressList.stream().filter(i -> (!emisCustomerAddressNew.getEnterpriseTaxId().equals(i.getEnterpriseTaxId()) || !emisCustomerAddressNew.getEnterpriseName().equals(i.getEnterpriseName()))).map(EmisCustomerAddress::getId).collect(Collectors.toList());
|
&& "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)) {
|
if (CollectionUtil.isEmpty(emisCustomerAddressIds)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emisCustomerAddressNew.getId() != null) {
|
if (emisCustomerAddressNew.getId() != null) {
|
||||||
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||||
emisCustomerAddress.setId(emisCustomerAddressNew.getId());
|
emisCustomerAddress.setId(emisCustomerAddressNew.getId());
|
||||||
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
|
emisCustomerAddress.setEnterpriseTaxId(newEnterpriseTaxId);
|
||||||
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
|
emisCustomerAddress.setEnterpriseName(newEnterpriseName);
|
||||||
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Long id : emisCustomerAddressIds) {
|
for (Long id : emisCustomerAddressIds) {
|
||||||
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||||
emisCustomerAddress.setId(id);
|
emisCustomerAddress.setId(id);
|
||||||
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
|
emisCustomerAddress.setEnterpriseTaxId(newEnterpriseTaxId);
|
||||||
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
|
emisCustomerAddress.setEnterpriseName(newEnterpriseName);
|
||||||
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3595,7 +3622,10 @@ public class EmisBaseService {
|
|||||||
public void checkAdress(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
|
public void checkAdress(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
|
||||||
if ("1".equals(emisCustomerAddressNew.getAddressType())) {
|
if ("1".equals(emisCustomerAddressNew.getAddressType())) {
|
||||||
if ("0086".equals(emisCustomerAddressNew.getCountry())) {
|
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, "企业名称/企业税号不能为空");
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "企业名称/企业税号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3643,7 +3673,7 @@ public class EmisBaseService {
|
|||||||
*/
|
*/
|
||||||
public boolean validateEnterpriseName(String enterpriseName) {
|
public boolean validateEnterpriseName(String enterpriseName) {
|
||||||
if (com.xdadan.erp.common.utils.StringUtils.isEmpty(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) {
|
public boolean validateEnterpriseTaxId(String enterpriseTaxId) {
|
||||||
if (com.xdadan.erp.common.utils.StringUtils.isEmpty(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;
|
int totalDays=(emisTransProduct.getMaxAging()+otherAddDay-1)+weekDays+notCaclDays;
|
||||||
log.info("计算预估到达时间:[maxAging="+emisTransProduct.getMaxAging()+",weekDays="+weekDays+",notCaclDays="+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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2166,6 +2166,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
|
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
|
||||||
sendAddress.setAddressType("1");
|
sendAddress.setAddressType("1");
|
||||||
sendAddress.setCustomerCode(customerCode);
|
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();
|
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);
|
createCustomerAddress(recieveAddress);
|
||||||
|
|
||||||
// 获取泡重比
|
// 获取泡重比
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user