Selaa lähdekoodia

修改税源问题

wks 2 vuotta sitten
vanhempi
commit
1dcf0c74f7

+ 6 - 6
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -313,6 +313,9 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper,TaxSourceD
      */
     @Override
     public String getAgreementId(String deptId, String userId, String companyId, String license, String volume) {
+        // 车牌前两位
+        String firstTwoPlates = license.substring(0, 2);
+
         String resultId = "";
         boolean isExclude = false;
         //排除的部门信息
@@ -322,8 +325,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper,TaxSourceD
                 .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
 
         //部门排除
-        if (excludeDepts.stream()
-                .filter(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId)).count() > 0) {
+        if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
             isExclude = true;
         }
 
@@ -332,8 +334,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper,TaxSourceD
                 .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
 
         //车牌排除
-        if (licenseExclude.stream()
-                .filter(taxSourceDto -> taxSourceDto.getExcludeInfo().contains(license)).count() > 0) {
+        if (licenseExclude.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().contains(firstTwoPlates))) {
             isExclude = true;
         }
 
@@ -349,10 +350,9 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper,TaxSourceD
                 }
             } else {
                 //查找配置的默认项
-                String substring = license.substring(0, 2);
                 TaxSourceDto taxSourceDefaultDto = baseMapper.selectOne(new LambdaQueryWrapper<TaxSourceDto>()
                         .eq(TaxSourceDto::getInsCompanyId, companyId)
-                        .eq(TaxSourceDto::getLicense, substring));
+                        .eq(TaxSourceDto::getLicense, firstTwoPlates));
                 if (taxSourceDefaultDto != null) {
                     resultId = taxSourceDefaultDto.getAgreementId();
                 }