|
@@ -24,12 +24,14 @@ import com.jeeplus.finance.projectReport.domain.CwProjectReportData;
|
|
|
import com.jeeplus.finance.projectReport.mapper.CwProjectReportMapper;
|
|
|
import com.jeeplus.finance.workClientInfo.domain.CwWorkClientBase;
|
|
|
import com.jeeplus.finance.workClientInfo.domain.CwWorkClientBilling;
|
|
|
+import com.jeeplus.finance.workClientInfo.mapper.CwWorkClientBaseMapper;
|
|
|
import com.jeeplus.finance.workClientInfo.mapper.CwWorkClientBillingMapper;
|
|
|
import com.jeeplus.finance.workClientInfo.service.CwWorkClientBillingService;
|
|
|
import com.jeeplus.finance.workClientInfo.service.CwWorkClientService;
|
|
|
//import com.jeeplus.pubmodules.oss.mapper.OssServiceMapper;
|
|
|
//import com.jeeplus.pubmodules.oss.service.OssService;
|
|
|
//import com.jeeplus.pubmodules.serialNumTpl.service.SerialnumTplService;
|
|
|
+import com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBaseDTO;
|
|
|
import com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBillingDTO;
|
|
|
import com.jeeplus.sys.domain.User;
|
|
|
import com.jeeplus.sys.feign.*;
|
|
@@ -70,7 +72,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
@Resource
|
|
|
private CwProjectReportMapper cwProjectReportMapper;
|
|
|
@Resource
|
|
|
- private CwWorkClientBillingMapper cwWorkClientBillingMapper;
|
|
|
+ private CwWorkClientBaseMapper cwWorkClientBaseMapper;
|
|
|
|
|
|
|
|
|
// @Resource
|
|
@@ -1235,7 +1237,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
//查询全部的发票信息
|
|
|
List<CwFinanceInvoiceDTO> invoiceDTOList = cwFinanceInvoiceMapper.getList(userDTO.getId());
|
|
|
//查询全部的客户信息
|
|
|
- List<CwWorkClientBillingDTO> clientBillingList = cwWorkClientBillingMapper.getList();
|
|
|
+ List<CwWorkClientBaseDTO> cwWorkClientBaseDTOList = cwWorkClientBaseMapper.getList();
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(listA)){
|
|
|
for (CwFinanceImportDTO cwFinanceImportDTO : listA) {
|
|
@@ -1270,7 +1272,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- return "关联红字发票编号——"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+"不存在,请重新填写";
|
|
|
+ return "关联红字发票编号——"+cwFinanceImportDTO.getRedInvoiceRelevancyNumber()+"不是当前登录人所创建,请重新填写";
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
@@ -1298,49 +1300,53 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
if (StringUtils.isBlank(cwFinanceImportDTO.getBillingType())){
|
|
|
return "开票类型不能为空";
|
|
|
}
|
|
|
- //发票类型校验
|
|
|
- if ("专票".equals(cwFinanceImportDTO.getType()) && "企业开票".equals(cwFinanceImportDTO.getBillingType()) && StringUtils.isNotBlank(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
- //根据单位查询客户信息
|
|
|
- boolean match = clientBillingList.stream().anyMatch(client -> cwFinanceImportDTO.getBillingWorkplaceReal().equals(client.getCompanyName()));
|
|
|
- if (match){
|
|
|
- for (CwWorkClientBillingDTO cwWorkClientBilling : clientBillingList) {
|
|
|
- if (cwWorkClientBilling.getCompanyName().equals(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
- if (StringUtils.isBlank(cwWorkClientBilling.getTaxpayerIdentificationNo())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的纳税人识别号在系统中不存在,请填写";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwWorkClientBilling.getAddress())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的地址在系统中不存在,请填写";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwWorkClientBilling.getPhone())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的电话在系统中不存在,请填写";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwWorkClientBilling.getAccountHolder())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的开户银行名称在系统中不存在,请填写";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwWorkClientBilling.getAccount())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的银行账号在系统中不存在,请填写";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getTaxpayerIdentificationNo())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,纳税人识别号不能为空";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getAddress())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,地址不能为空";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getTelPhone())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,电话不能为空";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getOpenBank())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,开户银行名称不能为空";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(cwFinanceImportDTO.getBankAccount())){
|
|
|
- return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,银行账号不能为空";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ //银行名称校验
|
|
|
+ if ("专票".equals(cwFinanceImportDTO.getType()) && "企业开票".equals(cwFinanceImportDTO.getBillingType()) && StringUtils.isBlank(cwFinanceImportDTO.getOpenBank())){
|
|
|
+ return "发票类型为专票且开票类型为企业开票下的开户银行名称不能为空";
|
|
|
}
|
|
|
+ //发票类型校验
|
|
|
+// if ("专票".equals(cwFinanceImportDTO.getType()) && "企业开票".equals(cwFinanceImportDTO.getBillingType()) && StringUtils.isNotBlank(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
+// //根据单位查询客户信息
|
|
|
+// boolean match = clientBillingList.stream().anyMatch(client -> cwFinanceImportDTO.getBillingWorkplaceReal().equals(client.getCompanyName()));
|
|
|
+// if (match){
|
|
|
+// for (CwWorkClientBillingDTO cwWorkClientBilling : clientBillingList) {
|
|
|
+// if (cwWorkClientBilling.getCompanyName().equals(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
+// if (StringUtils.isBlank(cwWorkClientBilling.getTaxpayerIdentificationNo())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的纳税人识别号在系统中不存在,请填写";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwWorkClientBilling.getAddress())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的地址在系统中不存在,请填写";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwWorkClientBilling.getPhone())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的电话在系统中不存在,请填写";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwWorkClientBilling.getAccountHolder())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的开户银行名称在系统中不存在,请填写";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwWorkClientBilling.getAccount())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"下的银行账号在系统中不存在,请填写";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// if (StringUtils.isBlank(cwFinanceImportDTO.getTaxpayerIdentificationNo())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,纳税人识别号不能为空";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwFinanceImportDTO.getAddress())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,地址不能为空";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwFinanceImportDTO.getTelPhone())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,电话不能为空";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwFinanceImportDTO.getOpenBank())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,开户银行名称不能为空";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(cwFinanceImportDTO.getBankAccount())){
|
|
|
+// return "客户名称——"+cwFinanceImportDTO.getBillingWorkplaceReal()+"在系统中不存在,银行账号不能为空";
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
arrayList.add(cwFinanceImportDTO);
|
|
|
}
|
|
@@ -1413,8 +1419,11 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
}
|
|
|
//开票金额
|
|
|
- cwFinanceInvoice.setAccount(cwFinanceImportDTO.getBaseAccount());
|
|
|
- cwFinanceInvoiceBase.setAccount(cwFinanceImportDTO.getBaseAccount());
|
|
|
+ if (StringUtils.isNotBlank(cwFinanceImportDTO.getBaseAccount())){
|
|
|
+ cwFinanceInvoice.setAccount(cwFinanceImportDTO.getBaseAccount());
|
|
|
+ cwFinanceInvoiceBase.setAccount(cwFinanceImportDTO.getBaseAccount());
|
|
|
+ }
|
|
|
+
|
|
|
//发票类型
|
|
|
if (StringUtils.isNotBlank(cwFinanceImportDTO.getType())){
|
|
|
for (String key : invoiceTypeValueDTOs.keySet()) {
|
|
@@ -1435,15 +1444,27 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
//实际开票单位
|
|
|
if ("企业开票".equals(cwFinanceImportDTO.getBillingType())){
|
|
|
- for (CwWorkClientBillingDTO cwWorkClientBilling : clientBillingList) {
|
|
|
- if (cwWorkClientBilling.getCompanyName().equals(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
- cwFinanceInvoice.setBillingWorkplaceRealId(cwWorkClientBilling.getClientId());
|
|
|
- cwFinanceInvoice.setBillingWorkplaceReal(cwWorkClientBilling.getCompanyName());
|
|
|
- cwFinanceInvoice.setTaxpayerIdentificationNo(cwWorkClientBilling.getTaxpayerIdentificationNo());
|
|
|
- cwFinanceInvoice.setAddress(cwWorkClientBilling.getAddress());
|
|
|
- cwFinanceInvoice.setTelPhone(cwWorkClientBilling.getPhone());
|
|
|
- cwFinanceInvoice.setOpenBank(cwWorkClientBilling.getAccountHolder());
|
|
|
- cwFinanceInvoice.setBankAccount(cwWorkClientBilling.getAccount());
|
|
|
+ for (CwWorkClientBaseDTO cwWorkClientBaseDTO : cwWorkClientBaseDTOList) {
|
|
|
+ if (cwWorkClientBaseDTO.getName().equals(cwFinanceImportDTO.getBillingWorkplaceReal())){
|
|
|
+ cwFinanceInvoice.setBillingWorkplaceRealId(cwWorkClientBaseDTO.getClientId());
|
|
|
+ cwFinanceInvoice.setBillingWorkplaceReal(cwWorkClientBaseDTO.getName());
|
|
|
+ cwFinanceInvoice.setTaxpayerIdentificationNo(cwWorkClientBaseDTO.getUscCode());
|
|
|
+ cwFinanceInvoice.setAddress(cwWorkClientBaseDTO.getAddress());
|
|
|
+ cwFinanceInvoice.setTelPhone(cwWorkClientBaseDTO.getMobile());
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(cwFinanceImportDTO.getOpenBank())){
|
|
|
+ List<CwWorkClientBillingDTO> billing = cwWorkClientBaseMapper.getBilling(cwWorkClientBaseDTO.getClientId());
|
|
|
+ if (CollectionUtils.isNotEmpty(billing)){
|
|
|
+ for (CwWorkClientBillingDTO cwWorkClientBillingDTO : billing) {
|
|
|
+ if (cwWorkClientBillingDTO.getAccountHolder().equals(cwFinanceImportDTO.getOpenBank())){
|
|
|
+ cwFinanceInvoice.setOpenBank(cwWorkClientBillingDTO.getAccountHolder());
|
|
|
+ cwFinanceInvoice.setBankAccount(cwWorkClientBillingDTO.getAccount());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1466,7 +1487,10 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
|
|
|
}
|
|
|
}
|
|
|
//开票内容要求
|
|
|
- cwFinanceInvoice.setBillingContentTerms(cwFinanceImportDTO.getBillingContentTerms());
|
|
|
+ if (StringUtils.isNotBlank(cwFinanceImportDTO.getBillingContentTerms())){
|
|
|
+ cwFinanceInvoice.setBillingContentTerms(cwFinanceImportDTO.getBillingContentTerms());
|
|
|
+ }
|
|
|
+
|
|
|
//关联红字发票编号
|
|
|
if (StringUtils.isNotBlank(cwFinanceImportDTO.getRedInvoiceRelevancyNumber())){
|
|
|
for (CwFinanceInvoiceDTO cwFinanceInvoiceDTO : invoiceDTOList) {
|