Преглед изворни кода

Merge remote-tracking branch 'origin/dev_jzg_lipf_v20260622' into dev_jzg_lipf_v20260622

jiakai пре 2 месеци
родитељ
комит
225eab6b50

+ 25 - 3
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLogAspect.java

@@ -195,6 +195,16 @@ public class OrderOperationLogAspect {
             track.setOptContent(log.description());
             track.setChangeAfter(JSONUtil.toJsonStr(vo));
             track.setResult(JSONUtil.toJsonStr(result));
+            InsOrders insOrders = orderService.getById(orderNo);
+            if(insOrders != null){
+                InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
+                track.setLicenseNo(carInfo.getLicenseNo());
+                track.setCompanyId(insOrders.getCompanyId());
+                // track.setResult(result.getMsg());
+            }else{
+                track.setResult("要修改的订单不存在");
+            }
+            track.setStatus(1);
             track.setOrderNo(orderNo);
             traceService.save(track);
 
@@ -209,13 +219,25 @@ public class OrderOperationLogAspect {
      */
     private void saveCostInfo(Object result, OrderOperationLog log, PtlAgreementCostRatioVo vo) {
         InsOrdersTrack track = new InsOrdersTrack();
+        String orderNo = vo.getOrderNo();
         track.setModule(log.module());
         track.setSubModule(log.subModule());
         track.setOptType(log.optType().getCode());
         track.setOptContent(log.description());
-        track.setResult(JSONUtil.toJsonStr(result));
-        track.setChangeAfter(JSONUtil.toJsonStr(vo));
-        track.setOrderNo(vo.getOrderNo());
+        track.setResult(JSONUtil.toJsonStr(vo));
+        InsOrders insOrders = orderService.getById(orderNo);
+        if(insOrders != null){
+            InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
+            track.setLicenseNo(carInfo.getLicenseNo());
+            track.setCompanyId(insOrders.getCompanyId());
+            // track.setResult(result.getMsg());
+        }else{
+            track.setResult("要进行费用调整的订单不存在");
+        }
+        track.setStatus(1);
+        track.setChangeBefore("");
+        track.setChangeAfter("费用调整完成");
+        track.setOrderNo(orderNo);
         track.setResult(JSONUtil.toJsonStr(result));
         traceService.save(track);
     }

+ 4 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java

@@ -477,6 +477,10 @@ public class QuoteVerificationAspect {
         if(isrecordByLeader){
             // 如果是代客录单,出口比例减去一个百分比,也就是 0.01 2026年7月11日09:30:09
             exportPercent = BigDecimalUtil.subtract(exportPercent, new BigDecimal("0.01"));
+            // 代客录单-1时,出口不够减的情况直接为0 add by lipf 2026年7月14日09:06:50
+            if(BigDecimal.ZERO.compareTo(exportPercent) <0){
+                exportPercent = new BigDecimal("0");
+            }
         }
 
         // 去税保费金额

+ 3 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeAuditServiceImpl.java

@@ -494,6 +494,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
             // 更新用户账户
             feeOrders = feeOrdersService.getById(param.getOrderNo());
+            log.info("根据订单查询出的费用信息如下:feeOrders=[{}]", JSONUtil.toJsonStr(feeOrders));
             HttpResult<SysUser> sysUserResult = orgClient.getUserOnlyIdByMobile(orders.getRealQuoteUserId());
             SysUser ywySysUser = sysUserResult.getData();
             HttpResult<SysUserAccount> result = orgClient.accountGet(ywySysUser.getId());
@@ -517,6 +518,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             }
             BigDecimal sumAmountUnpaid = userAccount.getSumAmountUnpaid();
             BigDecimal amount = feeOrders.getTotalPayablePremium();
+            log.info("费用审核通过。 amount=[{}].feeOrders=[{}]",amount, JSONUtil.toJsonStr(feeOrders));
             userAccount.setSumAmount(BigDecimalUtil.add(amount,userAccount.getSumAmount()));
             userAccount.setSumAmountUnpaid(BigDecimalUtil.add(amount, sumAmountUnpaid));
             orgClient.saveOrUpdate(userAccount);
@@ -531,6 +533,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             exportChangeLog.setIsDelete(0);
             exportChangeLog.setRemark("保单费用");
             exportChangeLog.setAmountBefore(sumAmountUnpaid);
+            log.info("准备调用orgClient保存账号变更明细:exportChangeLog=[{}]", JSONUtil.toJsonStr(exportChangeLog));
             orgClient.addUserAccountChangeLog(exportChangeLog);
 
             // 进入应收表

+ 7 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersTrackServiceImpl.java

@@ -1,12 +1,15 @@
 package com.jzg.quotation.summary.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.entity.dto.OrdersTrackParam;
 import com.jzg.commons.entity.orders.po.InsOrdersTrack;
 import com.jzg.commons.entity.vo.OrdersTrackVo;
 import com.jzg.quotation.summary.mapper.InsOrdersTrackMapper;
 import com.jzg.quotation.summary.service.InsOrdersTrackService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -20,8 +23,11 @@ import java.util.List;
 public class InsOrdersTrackServiceImpl extends ServiceImpl<InsOrdersTrackMapper, InsOrdersTrack>
     implements InsOrdersTrackService {
 
+    private static final Logger log = LoggerFactory.getLogger(InsOrdersTrackServiceImpl.class);
+
     @Override
     public List<OrdersTrackVo> list(OrdersTrackParam param) {
+        log.info("查询订单轨迹:param=[{}]", JSONUtil.toJsonStr(param));
         List<OrdersTrackVo> ordersTrackVos = baseMapper.queryList(param);
         return ordersTrackVos;
     }

+ 2 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/UserAccountController.java

@@ -1,6 +1,7 @@
 package com.jzg.organization.controller;
 
 
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
@@ -114,6 +115,7 @@ public class UserAccountController {
     @PostMapping("/addUserAccountChangeLog")
     public HttpResult<String> addUserAccountChangeLog(@RequestBody SysUserAccountChangeLog changeLog){
         try{
+            log.info("添加用户钱包账户记录。 changeLog=[{}]", JSONUtil.toJsonStr(changeLog));
            boolean save = sysUserAccountIncomeLogService.save(changeLog);
             if(save){
                 return HttpResult.ok("保存业务员账号明细成功");

+ 28 - 17
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -4525,12 +4525,16 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                         .map(InsPlyIncomeInvoiceSettlement::getActualReceivedAmount)
                         .filter(Objects::nonNull)
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
-                BigDecimal settlementPaymentDifference = insPlyIncomeInvoiceSettlements.stream()
-                        .map(InsPlyIncomeInvoiceSettlement::getSettlementPaymentDifference)
-                        .filter(Objects::nonNull)
-                        .reduce(BigDecimal.ZERO, BigDecimal::add);
+//                BigDecimal settlementPaymentDifference = insPlyIncomeInvoiceSettlements.stream()
+//                        .map(InsPlyIncomeInvoiceSettlement::getSettlementPaymentDifference)
+//                        .filter(Objects::nonNull)
+//                        .reduce(BigDecimal.ZERO, BigDecimal::add);
+
                 BigDecimal receivableSupervisePremium = action.getReceivableSupervisePremium()  != null ? action.getReceivableSupervisePremium(): BigDecimal.ZERO;
+
 //                BigDecimal overinflatedAmount = action.getOverinflatedAmount() != null? action.getOverinflatedAmount(): BigDecimal.ZERO;
+                // 回款差计算逻辑调整 2026年7月14日09:29:08
+                BigDecimal settlementPaymentDifference = BigDecimalUtil.subtract(settlementAmount,receivableSupervisePremium);
                 // 待结算金额 = 开票金额 - 已收金额
                 BigDecimal remainSettlementAmount = receivableSupervisePremium.subtract(BigDecimalUtil.add(settlementAmount, settlementPaymentDifference));
                 // 设置已结算的金额
@@ -4543,6 +4547,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 action.setRemainSettlementAmount( remainSettlementAmount);
                 action.setCompanyAllName(allCompanyHierarchyPaths.get(Objects.toString(action.getCompanyId(),"")));
                 action.setSettlementStatus(settlementStatusName);
+
                 // 回款差额
                 action.setSettlementPaymentDifference(settlementPaymentDifference);
 
@@ -5324,24 +5329,30 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         List<CompanySuperviseSettlementReportDto> allCompaniesIncomeDatas = baseMapper.queryCumulativeAccountsReceivable(systemCode, queryVo);
         // 结算状态在上面的sql进行过筛选了,后面就不再筛选了
         queryVo.setStatus(null);
-
-        // 车险
-        if("10".equals(queryVo.getAccountsReceivable())){
-            // 默认情况下,superviseFee 得到的就是车险的手续费
-            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().toList();
-        }else if("20".equals(queryVo.getAccountsReceivable())){
-            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
-                // 统计非车的手续费
-              action.setSuperviseFee(action.getSuperviseFee4Other());
-            }).toList();
-        }else if(StrUtil.isEmpty(queryVo.getAccountsReceivable())){
-                // 统计总的手续费
+        if("20".equals(queryVo.getAccountsReceivable())){
             allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
                 // 统计非车的手续费
-                action.setSuperviseFee(action.getTotalReceivable());
+                action.setSuperviseFee(action.getSuperviseFee4Other());
             }).toList();
         }
 
+        // 车险
+//        if("10".equals(queryVo.getAccountsReceivable())){
+//            // 默认情况下,superviseFee 得到的就是车险的手续费
+//            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().toList();
+//        }else if("20".equals(queryVo.getAccountsReceivable())){
+//            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
+//                // 统计非车的手续费
+//              action.setSuperviseFee(action.getSuperviseFee4Other());
+//            }).toList();
+//        }else if(StrUtil.isEmpty(queryVo.getAccountsReceivable())){
+//                // 统计总的手续费
+////            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
+////                // 统计非车的手续费
+////                action.setSuperviseFee(action.getTotalReceivable());
+////            }).toList();
+//        }
+
         // for test, 查看一家公司的数据,将不可变对象变成 可变对象
 //        allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().filter(action-> "1738811735599338932".equals(action.getCompanyId())).toList();
 //        allCompaniesIncomeDatas = new ArrayList<>(allCompaniesIncomeDatas);

+ 2 - 2
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -1930,8 +1930,8 @@
         ipi.company_id,
         ipi.system_code,
         sum(COALESCE(ipi.jq_receivable_premium, 0)+ COALESCE(ipi.sy_receivable_premium ,0)+coalesce(ipi.jy_receivable_premium ,0 )) as totalReceivable,
-        sum(COALESCE(ipi.jq_other_costs_premiums, 0)+ COALESCE(ipi.sy_other_costs_premiums,0)+coalesce(ipi.jy_other_costs_premiums,0 )) as superviseFee4Other ,
-        sum(COALESCE(ipi.jq_supervise_costs_premiums, 0)+ COALESCE(ipi.sy_supervise_costs_premiums,0)+coalesce(ipi.jy_supervise_costs_premiums,0 )) as superviseFee
+        sum(coalesce(ipi.jy_supervise_costs_premiums, 0)) AS superviseFee4Other,
+        sum(COALESCE(ipi.jq_supervise_costs_premiums, 0) + COALESCE(ipi.sy_supervise_costs_premiums,0) ) AS superviseFee
         from
         ins_ply_income ipi
         left join esm_ins_company eic on eic.id = ipi.company_id AND eic.is_delete = 0