|
|
@@ -629,38 +629,60 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param multipartFile
|
|
|
+ * @return resultList 包含总金额 还有 未匹配表中的数据
|
|
|
+ */
|
|
|
|
|
|
@Override
|
|
|
- public HashMap<String, Object> bxImportData(MultipartFile multipartFile) {
|
|
|
+ public HashMap<String, Object> bxImportData(MultipartFile multipartFile,String isNotCar) {
|
|
|
BigDecimal totalAmount=BigDecimal.ZERO;
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
+ ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
|
|
|
HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
StringBuffer strBuilder = new StringBuffer();
|
|
|
String ids="";
|
|
|
try {
|
|
|
List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
|
|
|
- for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
- params.clear();
|
|
|
- if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
|
|
|
- String licenseno = excelItem.getLicenseno();//车牌号
|
|
|
- params.put("licenseno",licenseno);
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
|
|
|
- String policyno = excelItem.getPolicyno(); //交强保单号
|
|
|
- params.put("policyno",policyno);
|
|
|
- }
|
|
|
+ if(!CollectionUtils.isEmpty(dtoList)){
|
|
|
+ for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
+ params.clear();
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
|
|
|
+ String licenseno = excelItem.getLicenseno();//车牌号
|
|
|
+ params.put("licenseno",licenseno);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
|
|
|
+ String policyno = excelItem.getPolicyno(); //交强保单号
|
|
|
+ params.put("policyno",policyno);
|
|
|
+ }
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
|
|
|
- String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
|
|
|
- params.put("syPolicyno",syPolicyno);
|
|
|
- }
|
|
|
-// 只查手续费
|
|
|
- params.put("isOther","0");
|
|
|
- params.put("isNotCar","0");
|
|
|
- InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
|
|
|
- strBuilder.append(insPlyIncome.getId()).append(",");
|
|
|
- if( insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
|
|
|
- totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue()); //添加总手续费
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
|
|
|
+ String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
|
|
|
+ params.put("syPolicyno",syPolicyno);
|
|
|
+ }
|
|
|
+// 只查手续费
|
|
|
+ params.put("isOther","0");
|
|
|
+ params.put("isNotCar",isNotCar);
|
|
|
+ InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
|
|
|
+ if(ObjectUtils.isNotEmpty(insPlyIncome)){ // 比配上汇总金额 未匹配则返回到数据当中
|
|
|
+ strBuilder.append(insPlyIncome.getId()).append(",");
|
|
|
+ if( insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue()); //添加总手续费
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ HashMap<String, Object> noMatching = new HashMap<>();
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
|
|
|
+ noMatching.put("licenseno",excelItem.getLicenseno());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
|
|
|
+ noMatching.put("policyno",excelItem.getPolicyno());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
|
|
|
+ noMatching.put("syPolicyno",excelItem.getSyPolicyno());
|
|
|
+ }
|
|
|
+ resultList.add(noMatching);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(strBuilder.length() >0){
|
|
|
@@ -668,6 +690,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
|
resultMap.put("ids",ids);
|
|
|
resultMap.put("totalAmount",totalAmount);
|
|
|
+ resultMap.put("resultList",resultList);
|
|
|
return resultMap;
|
|
|
} catch (IOException e) {
|
|
|
throw new SystemException("导入失败!");
|
|
|
@@ -676,35 +699,53 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HashMap<String, Object> bxImportNoData(MultipartFile multipartFile) {
|
|
|
+ public HashMap<String, Object> bxImportNoData(MultipartFile multipartFile,String isNotCar) {
|
|
|
BigDecimal totalAmount=BigDecimal.ZERO;
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
+ ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
|
|
|
StringBuffer strBuilder = new StringBuffer();
|
|
|
String ids="";
|
|
|
try {
|
|
|
List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
|
|
|
- for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
- params.clear();
|
|
|
- if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
|
|
|
- String licenseno = excelItem.getLicenseno();//车牌号
|
|
|
- params.put("licenseno",licenseno);
|
|
|
+ if(!CollectionUtils.isEmpty(dtoList)){
|
|
|
+ for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
+ params.clear();
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
|
|
|
+ String licenseno = excelItem.getLicenseno();//车牌号
|
|
|
+ params.put("licenseno",licenseno);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
|
|
|
+ String policyno = excelItem.getNoPolicyno(); //非车保单号
|
|
|
+ params.put("NoPolicyno",policyno);
|
|
|
+ }
|
|
|
+// 只查手续费
|
|
|
+ params.put("isOther","0");
|
|
|
+ params.put("isNotCar",isNotCar);
|
|
|
+ InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
|
|
|
+ if(ObjectUtils.isNotEmpty(insPlyIncome)){ // 比配上汇总金额 未匹配则返回到数据当中
|
|
|
+ strBuilder.append(insPlyIncome.getId()).append(",");
|
|
|
+ if( insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue()); //添加总手续费
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ HashMap<String, Object> noMatching = new HashMap<>();
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
|
|
|
+ noMatching.put("licenseno",excelItem.getLicenseno());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
|
|
|
+ noMatching.put("NoPolicyno",excelItem.getNoPolicyno());
|
|
|
+ }
|
|
|
+ resultList.add(noMatching);
|
|
|
+ }
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
|
|
|
- String policyno = excelItem.getNoPolicyno(); //非车保单号
|
|
|
- params.put("policyno",policyno);
|
|
|
+ if(strBuilder.length() >0){
|
|
|
+ ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
|
|
|
}
|
|
|
-// 只查手续费
|
|
|
- params.put("isOther","1");
|
|
|
- InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
|
|
|
- strBuilder.append(insPlyIncome.getId()).append(",");
|
|
|
- totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue()); //添加总手续费
|
|
|
+ resultMap.put("ids",ids);
|
|
|
+ resultMap.put("totalAmount",totalAmount);
|
|
|
+ resultMap.put("resultList",resultList);
|
|
|
}
|
|
|
- if(strBuilder.length() >0){
|
|
|
- ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
|
|
|
- }
|
|
|
- resultMap.put("ids",ids);
|
|
|
- resultMap.put("totalAmount",totalAmount);
|
|
|
return resultMap;
|
|
|
} catch (IOException e) {
|
|
|
throw new SystemException("导入失败!");
|
|
|
@@ -790,12 +831,30 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
return HttpResult.ok("",uploadUrl + "excel/" + fileName);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param insPlyIncomeVo 开票ids
|
|
|
+ * @return 返回开票号 开票金额 开票时间
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult<List<HashMap<String, Object>>> otherSettldetail(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ if (StringUtils.isNotEmpty(insPlyIncomeVo.getIncomeIds())) {
|
|
|
+ String incomeIds = insPlyIncomeVo.getIncomeIds();
|
|
|
+ List<HashMap<String, Object>> resultList = settlementDocumentaryFeesService.getOtherSettldetail(incomeIds);
|
|
|
+ if (resultList.size() > 0) {
|
|
|
+ return HttpResult.ok(resultList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updateByEntity(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
// 根据协议 如果是含增值税结算 用保费 * 如果是 不含税保费
|
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
|
|
|
+ this.amountCalculate(insPlyIncomeVo,insPlyIncome);
|
|
|
baseMapper.updateById(insPlyIncome);
|
|
|
|
|
|
insPlyIncomeVo.setCrudStatus("2");
|
|
|
@@ -803,6 +862,88 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param insPlyIncomeVo
|
|
|
+ * @param insPlyIncome
|
|
|
+ *
|
|
|
+ * 重新计算金额 通过比例
|
|
|
+ * 计算逻辑 交强不含税保费* 交强跟单比例 = 交强跟单金额
|
|
|
+ */
|
|
|
+ private void amountCalculate(InsPlyIncomeVo insPlyIncomeVo,InsPlyIncome insPlyIncome) {
|
|
|
+ BigDecimal jqNoTaxPremium = insPlyIncomeVo.getJqNoTaxPremium();// 交强手续费 按照思路 交强不含税保费* 交强手续费比例 =交强手续费
|
|
|
+ BigDecimal syNoTaxPremium = insPlyIncomeVo.getSyNoTaxPremium();// 商业手续费 按照思路 商业不含税保费* 商业手续费比例 =商业手续费
|
|
|
+ BigDecimal noNoTaxPremium = insPlyIncomeVo.getNoNoTaxPremium();// 非车手续费 按照思路 非车不含税保费* 非车手续费比例 =非车手续费
|
|
|
+ if(insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ BigDecimal jqhandingFee = jqNoTaxPremium.multiply(insPlyIncomeVo.getJqSuperviseCostsProportion().divide(new BigDecimal(100)));
|
|
|
+ insPlyIncome.setJqSuperviseCostsPremiums(jqhandingFee);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(insPlyIncomeVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ BigDecimal syhandingFee = syNoTaxPremium.multiply(insPlyIncomeVo.getSySuperviseCostsProportion().divide(new BigDecimal(100)));
|
|
|
+ insPlyIncome.setSySuperviseCostsPremiums(syhandingFee);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ BigDecimal nohandingFee = noNoTaxPremium.multiply(insPlyIncomeVo.getSySuperviseCostsProportion().divide(new BigDecimal(100)));
|
|
|
+ insPlyIncome.setNoSuperviseCostsPremiums(nohandingFee);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ BigDecimal jqother = jqNoTaxPremium.multiply(insPlyIncomeVo.getJqOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费 按照思路 交强不含税保费* 交强跟单比例 = 交强跟单金额
|
|
|
+ insPlyIncome.setJqOtherCostsPremium(jqother);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getSyOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费 按照思路 交强不含税保费* 交强跟单比例 = 交强跟单金额
|
|
|
+ insPlyIncome.setJqOtherCostsPremium(syother);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(insPlyIncomeVo.getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getNoOtherCostsProportion().divide(new BigDecimal(100)));//非车跟单费 按照思路 非车不含税保费* 非车跟单比例 = 非车跟单金额
|
|
|
+ insPlyIncome.setNoOtherCostsPremium(syother);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ 判断是否是平台 如果是平台则 手续费= 交强手续费+ 商业手续费+非车手续费 费单非= 交强跟单费+ 商业跟单费 +非车跟单费费
|
|
|
+ * 如果是保险 保险手续费= 交强手续费+商业跟单费 跟单费为null
|
|
|
+ * 保险跟单 手续费为null 跟单费= 交强跟单费+商业跟单费
|
|
|
+ * 非车手续费 =非车手续费
|
|
|
+ * 非车跟单 = 非车跟单费
|
|
|
+ */
|
|
|
+ if("1".equals(insPlyIncomeVo.getAgreementType())){//保险手续费
|
|
|
+ insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(),insPlyIncome.getSySuperviseCostsProportion(),insPlyIncome.getNoSuperviseCostsProportion())); //手续费比例
|
|
|
+ insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),insPlyIncome.getSySuperviseCostsPremiums(),insPlyIncome.getNoSuperviseCostsPremiums())); //手续费金额
|
|
|
+ insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),insPlyIncome.getSyOtherCostsProportion(),insPlyIncome.getNoOtherCostsProportion())); //跟单比例
|
|
|
+ insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),insPlyIncome.getSyOtherCostsPremium(),insPlyIncome.getNoOtherCostsPremium()));//跟单费金额
|
|
|
+ insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),insPlyIncome.getOtherFeevalue(),null)); // 总费用 = 手续费+跟单费
|
|
|
+ }else {
|
|
|
+ if("0".equals(insPlyIncomeVo.getIsNotDocumentary()) && "0".equals(insPlyIncomeVo.getIsNotCar())){ //保险手续费
|
|
|
+ insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),insPlyIncome.getSySuperviseCostsPremiums(),null)); // 手续费
|
|
|
+ insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(),insPlyIncome.getSySuperviseCostsProportion(),null));//手续费比例
|
|
|
+ insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),null,null));//总金额
|
|
|
+ }else { //保险跟单费 交强跟单+商业跟单
|
|
|
+ insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),insPlyIncome.getSyOtherCostsPremium(),null));
|
|
|
+ insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),insPlyIncome.getSyOtherCostsProportion(),null));
|
|
|
+ insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getOtherFeevalue(),null,null));//总金额
|
|
|
+
|
|
|
+ }
|
|
|
+ if("0".equals(insPlyIncomeVo.getIsNotDocumentary()) && "1".equals(insPlyIncomeVo.getIsNotCar())){// 非车
|
|
|
+ insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getNoSuperviseCostsPremiums(),null,null)); // 非车手续费
|
|
|
+ insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getNoSuperviseCostsProportion(),null,null)); //非车比例
|
|
|
+ insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),null,null));//总金额
|
|
|
+
|
|
|
+
|
|
|
+ }else { //非车跟单
|
|
|
+ insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getNoOtherCostsPremium(),null,null)); //非车跟单金额
|
|
|
+ insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getNoOtherCostsProportion(),null,null)); // 非车跟单比例
|
|
|
+ insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getOtherFeevalue(),null,null));//总金额
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void saveLog(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
|
// 添加记录
|
|
|
@@ -971,6 +1112,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getOtherFeevalue().subtract(insPlyIncomeVo.getInvoicCommissionFeevalue())); //未开票金额
|
|
|
settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());//已开票金额
|
|
|
settlementDocumentaryFeesVo.setSettlementStatus("2");
|
|
|
+ settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
|
|
|
+ settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
|
|
|
settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
|
|
|
return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
|
|
|
}
|
|
|
@@ -1064,7 +1207,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
for (int i =0; i <split.length ; i++) {
|
|
|
String id = split[i];
|
|
|
InsPlyIncome insPlyIncome = baseMapper.selectById(id);
|
|
|
- insPlyIncome.setContractId(insPlyIncomeVo.getContractId()); // 合同id
|
|
|
+ insPlyIncome.setInvoicId(insPlyIncomeVo.getContractId()); // 开票号
|
|
|
insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
|
|
|
insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
|
|
|
insPlyIncome.setSettlementTime(LocalDate.now());
|
|
|
@@ -1091,6 +1234,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
|
|
|
settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
|
|
|
settlementDocumentaryFeesVo.setSettlementStatus("1");
|
|
|
+ settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
|
|
|
+ settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());
|
|
|
return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
|
|
|
}
|
|
|
|