|
|
@@ -4,6 +4,8 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
@@ -18,6 +20,7 @@ import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
+import com.ydtech.modules.fnc.dao.SettlementDocumentaryFeesMapper;
|
|
|
import com.ydtech.modules.fnc.entity.*;
|
|
|
import com.ydtech.modules.fnc.service.*;
|
|
|
import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
|
|
|
@@ -125,8 +128,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
e.printStackTrace();
|
|
|
return HttpResult.error("查询异常");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1211,28 +1212,33 @@ handlingProportion,
|
|
|
noSuperviseCostsProportion)); //手续费比例 = 商业手续费比例 + 交强手续费比例 + 非车手续费比例
|
|
|
if (jqSuperviseCostsProportion != null && jqPremium != null) {
|
|
|
insPlyIncome.setJqSuperviseCostsPremiums(this.algorithmAmount(jqPremium, jqSuperviseCostsProportion)); //交强手续费
|
|
|
+ insPlyIncome.setJqSuperviseCostsProportion(jqSuperviseCostsProportion);
|
|
|
+
|
|
|
}
|
|
|
if (sySuperviseCostsProportion != null && syPremium != null) {
|
|
|
insPlyIncome.setSySuperviseCostsPremiums(this.algorithmAmount(syPremium, sySuperviseCostsProportion)); //商业手续费
|
|
|
+ insPlyIncome.setSySuperviseCostsProportion(sySuperviseCostsProportion);
|
|
|
}
|
|
|
if (noSuperviseCostsProportion != null && noPremium != null) {
|
|
|
insPlyIncome.setNoSuperviseCostsPremiums(this.algorithmAmount(noPremium, noSuperviseCostsProportion)); //非车手续费
|
|
|
+ insPlyIncome.setNoSuperviseCostsProportion(noSuperviseCostsProportion);
|
|
|
}
|
|
|
if (jqOtherCostsProportion != null && jqPremium != null) {
|
|
|
insPlyIncome.setJqOtherCostsPremium(this.algorithmAmount(jqPremium, jqOtherCostsProportion)); //交强跟单费
|
|
|
+ insPlyIncome.setJqOtherCostsProportion(jqOtherCostsProportion);
|
|
|
}
|
|
|
if (syOtherCostsProportion != null && syPremium != null) {
|
|
|
insPlyIncome.setSyOtherCostsPremium(this.algorithmAmount(syPremium, syOtherCostsProportion)); //商业跟单费
|
|
|
+ insPlyIncome.setSyOtherCostsProportion(syOtherCostsProportion);
|
|
|
}
|
|
|
if (noOtherCostsProportion != null && noPremium != null) {
|
|
|
insPlyIncome.setNoOtherCostsPremium(this.algorithmAmount(noPremium, noOtherCostsProportion)); //非车跟单费
|
|
|
+ insPlyIncome.setNoOtherCostsProportion(noOtherCostsProportion);
|
|
|
}
|
|
|
- insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),
|
|
|
- insPlyIncome.getSySuperviseCostsPremiums(), insPlyIncome.getNoSuperviseCostsPremiums())); //手续费
|
|
|
+ insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(), insPlyIncome.getSySuperviseCostsPremiums(), insPlyIncome.getNoSuperviseCostsPremiums())); //手续费
|
|
|
insPlyIncome.setCommissionFeerate(this.calculateTotal(jqSuperviseCostsProportion, sySuperviseCostsProportion,
|
|
|
- noSuperviseCostsProportion)); //手续费比例
|
|
|
- insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),
|
|
|
- insPlyIncome.getSyOtherCostsPremium(), insPlyIncome.getNoOtherCostsPremium())); //跟单费金额
|
|
|
+ noSuperviseCostsProportion)); //手续费比例
|
|
|
+ insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(), insPlyIncome.getSyOtherCostsPremium(), insPlyIncome.getNoOtherCostsPremium())); //跟单费金额
|
|
|
insPlyIncome.setOtherFeerate(this.calculateTotal(jqOtherCostsProportion, syOtherCostsProportion, noOtherCostsProportion));
|
|
|
//跟单费比例
|
|
|
insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(), insPlyIncome.getOtherFeevalue(), null)); // 总费用 = 手续费+跟单费
|
|
|
@@ -1279,16 +1285,12 @@ handlingProportion,
|
|
|
}
|
|
|
|
|
|
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.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 if ("1".equals(insPlyIncomeVo.getIsNotDocumentary()) && "0".equals(insPlyIncomeVo.getIsNotCar())) { //保险跟单费 交强跟单+商业跟单
|
|
|
- insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),
|
|
|
- insPlyIncome.getSyOtherCostsPremium(), null));
|
|
|
- insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),
|
|
|
- insPlyIncome.getSyOtherCostsProportion(), null));
|
|
|
+ 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())) {// 非车
|
|
|
@@ -1395,33 +1397,45 @@ handlingProportion,
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除id 已开票或者已结算都不可以进行 删除
|
|
|
+ * 因为跟单没有关联表 也无法关联到开票表所以只能按照 条件去查询判断 保司机构 id
|
|
|
+ * @param insPlyIncomeVo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public HttpResult<InsPlyIncome> deleteById(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
-
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
- if (StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())) {
|
|
|
- params.put("isNotCar", insPlyIncomeVo.getIsNotCar());
|
|
|
- }
|
|
|
- params.put("isOther", "1");
|
|
|
- if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
|
|
|
- params.put("year", insPlyIncomeVo.getYear());
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())) {
|
|
|
- params.put("companyId", insPlyIncomeVo.getCompanyId());
|
|
|
- }
|
|
|
- baseMapper.deleteById(insPlyIncomeVo.getId());
|
|
|
- insPlyIncomeVo.setCrudStatus("3");
|
|
|
- this.saveLog(insPlyIncomeVo);
|
|
|
- List<InsPlyIncome> list = this.baseMapper.NonSettlementQuery(params);
|
|
|
- if (!CollectionUtils.isEmpty(list)) {
|
|
|
- for (InsPlyIncome item : list) {
|
|
|
- return HttpResult.ok(item.getIds());
|
|
|
+ params.put("id",insPlyIncomeVo.getId());
|
|
|
+ List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
|
|
|
+ InsPlyIncome insPlyIncome = insPlyIncomes.get(0);
|
|
|
+ if (StringUtils.isNotEmpty(insPlyIncome.getAgreementType()) && "1".equals(insPlyIncome.getAgreementType())) {
|
|
|
+ if ("1".equals(insPlyIncome.getHandlingFeesStatus())) {
|
|
|
+ throw new SystemException("已结算不可以进行删除");
|
|
|
+ }
|
|
|
+ } else if (StringUtils.isNotEmpty(insPlyIncome.getAgreementType()) && "2".equals(insPlyIncome.getAgreementType())) {
|
|
|
+ if ("0".equals(insPlyIncome.getIsNotDocumentary())) {
|
|
|
+ String taskId = insPlyIncome.getTaskId();
|
|
|
+ if (StringUtils.isNotEmpty(taskId)) {
|
|
|
+ throw new SystemException("已开票不能进行删除");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+// 因为跟单没有关联表 也无法关联到开票表所以只能按照 条件去进行判断
|
|
|
+ String partnerCompaniesId = insPlyIncome.getPartnerCompaniesId(); // 保司机构id
|
|
|
+ if (StringUtils.isEmpty(partnerCompaniesId)) {
|
|
|
+ throw new SystemException("该单据没有保司机构id");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<SettlementDocumentaryFeesEntity> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(SettlementDocumentaryFeesEntity::getPartnerCompaniesId, partnerCompaniesId)
|
|
|
+ .eq(SettlementDocumentaryFeesEntity::getSettlementStatus, "2");
|
|
|
+ List<SettlementDocumentaryFeesEntity> settlementDocumentaryFeesEntities = settlementDocumentaryFeesService.getBaseMapper().selectList(queryWrapper);
|
|
|
+ if (settlementDocumentaryFeesEntities.size() > 0) {
|
|
|
+ throw new SystemException("已开票不能进行删除");
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- return HttpResult.ok(null);
|
|
|
-
|
|
|
}
|
|
|
+ baseMapper.deleteById(insPlyIncomeVo.getId()); //删除 结算 然后删除结算表
|
|
|
return HttpResult.ok("删除成功");
|
|
|
|
|
|
}
|
|
|
@@ -1569,7 +1583,7 @@ handlingProportion,
|
|
|
BigDecimal noInvoicCommissionFeevalue = BigDecimal.ZERO; //未开票金额
|
|
|
BigDecimal unSettledAmount; //未结算金额
|
|
|
params.put("partnerCompaniesId", item.getPartnerCompaniesId());
|
|
|
-
|
|
|
+ params.remove("handlingFeesStatus");
|
|
|
List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params); //金额总数
|
|
|
for (InsPlyIncome all : insPlyIncomes) {
|
|
|
commissionFeevalue = commissionFeevalue.add(all.getCommissionFeevalue());
|