|
@@ -24,6 +24,7 @@ import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
|
|
|
import com.ydtech.modules.protocol.service.ITaxSourceService;
|
|
import com.ydtech.modules.protocol.service.ITaxSourceService;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -79,10 +80,10 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public boolean saveTaxSource(TaxSourceVo taxSourceVo) {
|
|
public boolean saveTaxSource(TaxSourceVo taxSourceVo) {
|
|
|
//删除排除的信息
|
|
//删除排除的信息
|
|
|
- taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId,
|
|
|
|
|
- taxSourceVo.getInsCompanyId()));
|
|
|
|
|
|
|
+ taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
|
|
|
//删除税源配置信息
|
|
//删除税源配置信息
|
|
|
- baseMapper.delete(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
|
|
|
|
|
|
|
+ baseMapper.delete(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
|
|
|
|
|
+ taxSourceVo.getInsCompanyId()));
|
|
|
//组装税源数据
|
|
//组装税源数据
|
|
|
List<TaxSourceDto> dtos = new ArrayList<>();
|
|
List<TaxSourceDto> dtos = new ArrayList<>();
|
|
|
List<TaxSourceExcludeDto> excludeDtos = new ArrayList<>();
|
|
List<TaxSourceExcludeDto> excludeDtos = new ArrayList<>();
|
|
@@ -140,16 +141,15 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
public TaxSourceVo getTaxSource(String companyId) {
|
|
public TaxSourceVo getTaxSource(String companyId) {
|
|
|
TaxSourceVo taxSourceVo = new TaxSourceVo();
|
|
TaxSourceVo taxSourceVo = new TaxSourceVo();
|
|
|
//税源信息
|
|
//税源信息
|
|
|
- List<TaxSourceDto> taxSourceDto = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
|
|
|
|
|
- companyId));
|
|
|
|
|
|
|
+ List<TaxSourceDto> taxSourceDto =
|
|
|
|
|
+ baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
|
|
|
|
|
+ companyId));
|
|
|
//排除的部门信息
|
|
//排除的部门信息
|
|
|
- List<TaxSourceExcludeDto> taxSourceExcludeDepts = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
|
|
|
|
+ List<TaxSourceExcludeDto> taxSourceExcludeDepts =
|
|
|
|
|
+ taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
//排除的车牌号信息
|
|
//排除的车牌号信息
|
|
|
- List<TaxSourceExcludeDto> taxSourceExcludeLicense = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
|
|
|
|
|
|
|
+ List<TaxSourceExcludeDto> taxSourceExcludeLicense =
|
|
|
|
|
+ taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
|
|
|
|
|
|
|
|
taxSourceVo.setInsCompanyId(companyId);
|
|
taxSourceVo.setInsCompanyId(companyId);
|
|
|
|
|
|
|
@@ -207,24 +207,28 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// @Override
|
|
// @Override
|
|
|
-// public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, String license,String volume) {
|
|
|
|
|
|
|
+// public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, String license,
|
|
|
|
|
+// String volume) {
|
|
|
// //查出所有协议
|
|
// //查出所有协议
|
|
|
// List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
|
|
// List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
|
|
|
// if(license != null && volume != null) {
|
|
// if(license != null && volume != null) {
|
|
|
// //排除的部门信息
|
|
// //排除的部门信息
|
|
|
-// List<TaxSourceExcludeDto> excludeDepts = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq
|
|
|
|
|
|
|
+// List<TaxSourceExcludeDto> excludeDepts = taxSourceExcludeService.list(new
|
|
|
|
|
+// LambdaQueryWrapper<TaxSourceExcludeDto>().eq
|
|
|
// (TaxSourceExcludeDto::getExcludeInfo, deptId)
|
|
// (TaxSourceExcludeDto::getExcludeInfo, deptId)
|
|
|
// .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
// .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
//
|
|
//
|
|
|
// agreementInsCompany.forEach(item ->
|
|
// agreementInsCompany.forEach(item ->
|
|
|
// excludeDepts.stream()
|
|
// excludeDepts.stream()
|
|
|
-// .filter(taxSourceDto -> item.getId().equals(taxSourceDto.getInsCompanyId()) && taxSourceDto.getExcludeInfo
|
|
|
|
|
|
|
+// .filter(taxSourceDto -> item.getId().equals(taxSourceDto.getInsCompanyId()) &&
|
|
|
|
|
+// taxSourceDto.getExcludeInfo
|
|
|
// ().equals(deptId))
|
|
// ().equals(deptId))
|
|
|
// .findFirst()
|
|
// .findFirst()
|
|
|
// .ifPresent(taxSourceDto -> item.setIsExclude(TaxSourceStatusConstants.TAX_SOURCE_START))
|
|
// .ifPresent(taxSourceDto -> item.setIsExclude(TaxSourceStatusConstants.TAX_SOURCE_START))
|
|
|
// );
|
|
// );
|
|
|
// //查找排除的车牌号
|
|
// //查找排除的车牌号
|
|
|
-// List<TaxSourceExcludeDto> licenseExclude = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq
|
|
|
|
|
|
|
+// List<TaxSourceExcludeDto> licenseExclude = taxSourceExcludeService.list(new
|
|
|
|
|
+// LambdaQueryWrapper<TaxSourceExcludeDto>().eq
|
|
|
// (TaxSourceExcludeDto::getExcludeInfo, license)
|
|
// (TaxSourceExcludeDto::getExcludeInfo, license)
|
|
|
// .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
|
|
// .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
|
|
|
// agreementInsCompany.forEach(item -> {
|
|
// agreementInsCompany.forEach(item -> {
|
|
@@ -292,8 +296,8 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
|
|
List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
|
|
|
|
|
|
|
|
//查找是否配置税源
|
|
//查找是否配置税源
|
|
|
- List<TaxSourceDto> taxSourceDtos = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource,
|
|
|
|
|
- "1"));
|
|
|
|
|
|
|
+ List<TaxSourceDto> taxSourceDtos =
|
|
|
|
|
+ baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
|
|
|
//设置税源参数
|
|
//设置税源参数
|
|
|
agreementInsCompany.forEach(item -> {
|
|
agreementInsCompany.forEach(item -> {
|
|
|
if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
|
|
if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
|
|
@@ -324,27 +328,31 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public String getAgreementId(String deptId, String userId, String companyId, String license, String volume, String productid) {
|
|
|
|
|
|
|
+ public String getAgreementId(String deptId, String userId, String companyId, String license, String volume,
|
|
|
|
|
+ String productid) {
|
|
|
// 车牌前两位
|
|
// 车牌前两位
|
|
|
String firstTwoPlates = license.substring(0, 2);
|
|
String firstTwoPlates = license.substring(0, 2);
|
|
|
String resultId = "";
|
|
String resultId = "";
|
|
|
|
|
|
|
|
//查找配置的默认项
|
|
//查找配置的默认项
|
|
|
- List<TaxSourceDto> taxSourceDtoList = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>()
|
|
|
|
|
- .eq(TaxSourceDto::getInsCompanyId, companyId));
|
|
|
|
|
|
|
+ List<TaxSourceDto> taxSourceDtoList =
|
|
|
|
|
+ baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
|
|
|
|
|
+ companyId));
|
|
|
|
|
+
|
|
|
|
|
+ if(taxSourceDtoList.isEmpty()){
|
|
|
|
|
+ return resultId;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
List<TaxSourceDto> taxSource =
|
|
List<TaxSourceDto> taxSource =
|
|
|
taxSourceDtoList.stream().filter(x -> x.getLicense().equals(firstTwoPlates)).collect(Collectors.toList());
|
|
taxSourceDtoList.stream().filter(x -> x.getLicense().equals(firstTwoPlates)).collect(Collectors.toList());
|
|
|
if (!taxSource.isEmpty()) {
|
|
if (!taxSource.isEmpty()) {
|
|
|
- resultId = taxSourceDtoList.get(0).getAgreementId();
|
|
|
|
|
|
|
+ resultId = taxSource.get(0).getAgreementId();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
boolean isExclude = false;
|
|
boolean isExclude = false;
|
|
|
//排除的部门信息
|
|
//排除的部门信息
|
|
|
- List<TaxSourceExcludeDto> excludeDepts = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getExcludeInfo, deptId)
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
|
|
|
|
+ List<TaxSourceExcludeDto> excludeDepts =
|
|
|
|
|
+ taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, deptId).eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
|
|
|
|
|
//部门排除
|
|
//部门排除
|
|
|
if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
|
|
if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
|
|
@@ -353,9 +361,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
|
|
|
|
|
//查找排除的车牌号
|
|
//查找排除的车牌号
|
|
|
List<TaxSourceExcludeDto> licenseExclude =
|
|
List<TaxSourceExcludeDto> licenseExclude =
|
|
|
- taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo,
|
|
|
|
|
- firstTwoPlates)
|
|
|
|
|
- .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
|
|
|
|
|
|
|
+ taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, firstTwoPlates).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
|
|
|
|
|
|
|
|
//车牌排除
|
|
//车牌排除
|
|
|
if (licenseExclude.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(firstTwoPlates))) {
|
|
if (licenseExclude.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(firstTwoPlates))) {
|
|
@@ -365,16 +371,19 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
|
|
|
// 税源
|
|
// 税源
|
|
|
TaxSourceDto taxSourceDtos =
|
|
TaxSourceDto taxSourceDtos =
|
|
|
taxSourceDtoList.stream().filter(x -> x.getIsTaxSource().equals("1")).collect(Collectors.toList()).get(0);
|
|
taxSourceDtoList.stream().filter(x -> x.getIsTaxSource().equals("1")).collect(Collectors.toList()).get(0);
|
|
|
|
|
+
|
|
|
if (!isExclude && (Float.parseFloat(volume) >= 1) && (taxSourceDtos != null)) {
|
|
if (!isExclude && (Float.parseFloat(volume) >= 1) && (taxSourceDtos != null)) {
|
|
|
resultId = taxSourceDtos.getAgreementId();
|
|
resultId = taxSourceDtos.getAgreementId();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 不包含险种 随机其他保险公司
|
|
// 不包含险种 随机其他保险公司
|
|
|
- if (taxSourceDtos != null && taxSourceDtos.getInsuranceRepertoire().contains(productid) && Objects.equals(resultId, taxSourceDtos.getAgreementId())) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (taxSourceDtos != null && taxSourceDtos.getAgreementId().equals(resultId) && taxSourceDtos.getInsuranceRepertoire().contains(productid+",")) {
|
|
|
resultId = taxSourceDtos.getBanishAgreementId();
|
|
resultId = taxSourceDtos.getBanishAgreementId();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return resultId;
|
|
return resultId;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|