From 3e76171990be40e226341da1cd7c2d159c9a3b70 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 02 二月 2024 18:11:31 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   57 ++++++++++++++++-----------------------------------------
 1 files changed, 16 insertions(+), 41 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
index f9c7c8f..d8911d9 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -817,7 +817,14 @@
         updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add));
         insuranceApplyMapper.updateById(updBean);
         //瀛樺偍鏃ュ織鏁版嵁
-        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.UPLOAD;
+        String info =applyLogType.getInfo();
+//        info = info.replace("${param}", update.getCheckInfo());
+        ApplyLog log = new ApplyLog(insuranceApply,applyLogType.getName(),info,insuranceApply.getId(),applyLogType.getKey(),null, null);
+        applyLogMapper.insert(log);
+
+
+
         //鍙戦�佸緟鍔炰笟鍔�
 
         //瀛樺偍寰呭姙淇℃伅
@@ -896,7 +903,12 @@
         insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add));
         insuranceApplyMapper.updateById(insuranceApply);
         //瀛樺偍鏃ュ織鏁版嵁
-        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
+
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.UPLOAD_AGAIN;
+        String info =applyLogType.getInfo();
+//        info = info.replace("${param}", update.getCheckInfo());
+        ApplyLog log = new ApplyLog(insuranceApply,applyLogType.getName(),info,insuranceApply.getId(),applyLogType.getKey(),null, null);
+        applyLogMapper.insert(log);
 
 
         //瀛樺偍寰呭姙淇℃伅
@@ -1009,43 +1021,6 @@
     }
 
 
-    public void saveApplyLog(InsuranceApply insuranceApply,Constants.InsuranceApplyStatus insuranceApplyStatus,String content){
-        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        ApplyLog applyLog = new ApplyLog();
-        applyLog.setCreateDate(new Date());
-        applyLog.setCreator(loginUserInfo.getId());
-        applyLog.setIsdeleted(Constants.ZERO);
-        applyLog.setApplyId(insuranceApply.getId());
-        applyLog.setTitle(insuranceApplyStatus.getName());
-        applyLog.setContent(content);
-        applyLog.setObjType(insuranceApplyStatus.getKey());
-        applyLog.setObjId( insuranceApply.getId());
-        applyLog.setStatus(insuranceApply.getStatus());
-        applyLogMapper.insert(applyLog);
-    }
-
-
-
-//    public BigDecimal countDetailFee(Solutions solutions ,Date startDate,Date endDate){
-//        //鏌ヨ淇濋櫓瀹為檯鍛ㄦ湡
-//        Integer cycle = DateUtil.calculateBetween(endDate,startDate,solutions.getDataType());
-//        if(cycle==-1){
-//            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏃ユ湡淇℃伅閿欒!");
-//        }
-//        return solutions.getPrice().multiply(new BigDecimal(cycle));
-//    }
-
-//    public static void main(String[] args) {
-//        Date date1 = DateUtil.StringToDate("2023-03-01 00:00:00");
-//        Date date2 = DateUtil.StringToDate("2023-04-01 00:00:00");
-//        System.out.println(DateUtil.calculateBetween(date1,date2,0));
-//        System.out.println(DateUtil.calculateBetween(date1,date2,1));
-//        System.out.println(DateUtil.calculateBetween(date1,date2,2));
-//        System.out.println(DateUtil.calculateBetween(date1,date2,3));
-//
-//    }
-
-
     @Override
     public void deleteById(Integer id) {
         insuranceApplyMapper.deleteById(id);
@@ -1109,7 +1084,7 @@
         queryWrapper.select(" DATEDIFF( t.END_TIME ,now()  ) AS loseEfficacyDays ");
         queryWrapper.select(" ( select count(1) from apply_detail ad  where ad.apply_id = t.id ) as insureNum");
         if(!Objects.isNull(pageWrap.getModel())&&!Objects.isNull(pageWrap.getModel().getType())){
-            queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney");
+            queryWrapper.select(" ifnull(( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ),0) as taxesMoney");
             queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast ");
         }
         queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
@@ -1302,6 +1277,7 @@
                         .selectAs(Company::getName,ApplyLog::getCompanyName)
                         .leftJoin(SystemUser.class,SystemUser::getId,ApplyLog::getCreator)
                         .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
+                        .in(ApplyLog::getObjType,Constants.ApplyLogType.getTypeList(Constants.ZERO))
                         .eq(ApplyLog::getApplyId,insuranceApply.getId())
                         .orderByAsc(ApplyLog::getCreateDate)
         );
@@ -1472,7 +1448,6 @@
         info = info.replace("${param}", insuranceApplyOptDTO.getOptIllustration());
         ApplyLog log = new ApplyLog(insuranceApply,applyLogType.getName(),info,insuranceApply.getId(),applyLogType.getKey(),JSONObject.toJSONString(insuranceApply), JSONObject.toJSONString(insuranceApply));
         applyLogMapper.insert(log);
-//        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
     }
 
 

--
Gitblit v1.9.3