浏览代码

会计发票导入调整

sangwenwei 1 月之前
父节点
当前提交
ceb71ecf54

+ 5 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/controller/CwFinanceInvoiceController.java

@@ -642,6 +642,11 @@ public class CwFinanceInvoiceController {
         listA = EasyPoiUtil.importExcel(file, 1, 1, CwFinanceImportDTO.class);
         //去除excel中的空行
         listA = getExList(listA);
+        //去除示例行
+        listA.removeIf(item -> {
+            String number = (item).getReportNo();
+            return number != null && number.contains("例");
+        });
         //导入前检测数据
         String resultA = cwFinanceInvoiceService.importFinance(listA, arrayList, hashMap);
         if(StringUtils.isNotBlank(resultA)){

+ 81 - 57
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/CwFinanceInvoiceService.java

@@ -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) {

+ 2 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/workClientInfo/mapper/CwWorkClientBaseMapper.java

@@ -58,6 +58,8 @@ public interface CwWorkClientBaseMapper extends BaseMapper<CwWorkClientBase> {
     public IPage<CwWorkClientBaseDTO> getInfoList(Page<CwWorkClientBaseDTO> page, @Param(Constants.WRAPPER) QueryWrapper<CwWorkClientBase> queryWrapper);
 
     List<CwWorkClientBillingDTO> getBilling(@Param("id") String id);
+
+    List<CwWorkClientBaseDTO> getList();
 }
 
 

+ 21 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/workClientInfo/mapper/xml/CwWorkClientBaseMapper.xml

@@ -406,4 +406,25 @@
         left join act_ru_task art on cw_wcb.proc_ins_id = art.PROC_INST_ID_
         ${ew.customSqlSegment}
     </select>
+
+    <select id="getList" resultType="com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBaseDTO">
+        select
+        <include refid="Base_Column_List"></include>,
+        su.name as user_name,
+        cw_wct.is_listed as is_listed,
+        cw_wct.ownership_type as ownership_type,
+        cw_wct.final_status_type as final_status_type,
+        cw_mlt.name as manage_level_type_name,
+        cw_ot.name as organization_type_name,
+        su1.name as update_user_name,
+        cw_wct.client_id AS client_id,
+        art.ID_ as task_id
+        from cw_work_client_base cw_wcb
+        left join sys_user su on su.id = cw_wcb.create_by_id and su.del_flag = '0'
+        left join cw_work_client_type cw_wct on cw_wct.client_id = cw_wcb.id and cw_wct.del_flag = '0'
+        left join cw_manage_level_type cw_mlt on cw_mlt.id = cw_wcb.manage_level_type and cw_mlt.del_flag = '0'
+        left join cw_organization_type cw_ot on cw_ot.id = cw_wcb.organization_type and cw_ot.del_flag = '0'
+        left join sys_user su1 on su1.id = cw_wcb.update_user and su1.del_flag = '0'
+        left join act_ru_task art on cw_wcb.proc_ins_id = art.PROC_INST_ID_
+    </select>
 </mapper>

二进制
jeeplus-modules/jeeplus-finance/src/main/resources/dot/发票导入模板.xlsx