demand: 网点费用申请申请时校验寄件人地址
committer: heyu
This commit is contained in:
parent
55eee453ea
commit
f5dba8617b
@ -3560,6 +3560,31 @@ public class EmisBaseService {
|
||||
*/
|
||||
public int createCustomerAddressNew(EmisCustomerAddress emisCustomerAddressNew) throws EmisBizError {
|
||||
|
||||
checkAdress(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 -> (StringUtil.isBlank(i.getEnterpriseTaxId()) || StringUtil.isBlank(i.getEnterpriseName()))).map(EmisCustomerAddress::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(emisCustomerAddressIds)) {
|
||||
return 1;
|
||||
}
|
||||
for (Long id : emisCustomerAddressIds) {
|
||||
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||
emisCustomerAddress.setId(id);
|
||||
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
|
||||
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
|
||||
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
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())) {
|
||||
@ -3582,27 +3607,6 @@ public class EmisBaseService {
|
||||
emisCustomerAddressNew.setEnterpriseName(null);
|
||||
emisCustomerAddressNew.setEnterpriseTaxId(null);
|
||||
}
|
||||
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 -> (StringUtil.isBlank(i.getEnterpriseTaxId()) || StringUtil.isBlank(i.getEnterpriseName()))).map(EmisCustomerAddress::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(emisCustomerAddressIds)) {
|
||||
return 1;
|
||||
}
|
||||
for (Long id : emisCustomerAddressIds) {
|
||||
EmisCustomerAddress emisCustomerAddress = new EmisCustomerAddress();
|
||||
emisCustomerAddress.setId(id);
|
||||
emisCustomerAddress.setEnterpriseTaxId(emisCustomerAddressNew.getEnterpriseTaxId());
|
||||
emisCustomerAddress.setEnterpriseName(emisCustomerAddressNew.getEnterpriseName());
|
||||
emisCustomerAddressMapper.updateEmisCustomerAddress(emisCustomerAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisWaybillAjustApplyServiceImpl.java
|
||||
* @author linfso
|
||||
* @date 2024-06-25 23:39:28
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 运单调整申请 实体类 </p>
|
||||
*/
|
||||
|
||||
@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 运单调整申请Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-06-25 23:39:28
|
||||
*/
|
||||
@ -72,7 +72,7 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 查询运单调整申请
|
||||
*
|
||||
*
|
||||
* @param id 运单调整申请主键
|
||||
* @return 运单调整申请
|
||||
*/
|
||||
@ -85,7 +85,7 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 查询运单调整申请列表
|
||||
*
|
||||
*
|
||||
* @param emisWaybillAjustApply 运单调整申请
|
||||
* @return 运单调整申请
|
||||
*/
|
||||
@ -97,8 +97,8 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 检查是否重复
|
||||
*
|
||||
* @param emisWaybillAjustApply
|
||||
*
|
||||
* @param emisWaybillAjustApply
|
||||
* @return 数量
|
||||
*/
|
||||
@Override
|
||||
@ -109,13 +109,14 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 新增运单调整申请
|
||||
*
|
||||
*
|
||||
* @param emisWaybillAjustApply 运单调整申请
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisWaybillAjustApply(EmisWaybillAjustApply emisWaybillAjustApply) throws EmisBizError {
|
||||
|
||||
EmisWaybill emisWaybillSave = getEmisWaybillNewFromJson(emisWaybillAjustApply);
|
||||
// 判断单号是否存在
|
||||
EmisWaybill emisWaybillOld=getWaybillByBillCode(emisWaybillAjustApply.getBillCode());
|
||||
if(emisWaybillOld==null){
|
||||
@ -148,6 +149,25 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
checkVirtualParam(getEmisWaybillNewFromJson(emisWaybillAjustApply),emisWaybillOld);
|
||||
}
|
||||
|
||||
// 发件地址
|
||||
EmisCustomerAddress sendAddress = new EmisCustomerAddress();
|
||||
sendAddress.setCountry(emisWaybillSave.getSendCountry());
|
||||
sendAddress.setName(emisWaybillSave.getSendName());
|
||||
sendAddress.setPhone(emisWaybillSave.getSendMobile());
|
||||
sendAddress.setProvince(emisWaybillSave.getSendProvince());
|
||||
sendAddress.setCity(emisWaybillSave.getSendCity());
|
||||
sendAddress.setCounty(emisWaybillSave.getSendCounty());
|
||||
sendAddress.setTown(emisWaybillSave.getSendTown());
|
||||
// recieveAddress.setEmail(emisWaybillSave);
|
||||
sendAddress.setAddress(emisWaybillSave.getSendAddress());
|
||||
sendAddress.setCompany(emisWaybillSave.getSendCompany());
|
||||
|
||||
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
|
||||
sendAddress.setAddressType("1");
|
||||
sendAddress.setEnterpriseName(emisWaybillSave.getEnterpriseName());
|
||||
sendAddress.setEnterpriseTaxId(emisWaybillSave.getEnterpriseTaxId());
|
||||
checkAdress(sendAddress);
|
||||
|
||||
// 插入数据
|
||||
emisWaybillAjustApply.setApplyDate(new Date());
|
||||
emisWaybillAjustApply.setApplySiteCode(SecurityUtils.getLoginUser().getUser().getOwnerSiteCode());
|
||||
@ -180,7 +200,7 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 修改运单调整申请
|
||||
*
|
||||
*
|
||||
* @param emisWaybillAjustApply 运单调整申请
|
||||
* @return 结果
|
||||
*/
|
||||
@ -192,7 +212,7 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 批量删除运单调整申请
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的运单调整申请主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -204,7 +224,7 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
|
||||
/**
|
||||
* 删除运单调整申请信息
|
||||
*
|
||||
*
|
||||
* @param id 运单调整申请主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user