From d6a6513dd8ff55449844264b24a3051c683febb7 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 22 一月 2024 10:03:34 +0800
Subject: [PATCH] 开发业务接口

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   95 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 85 insertions(+), 10 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 8940095..115644b 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
@@ -68,6 +68,66 @@
 
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer back(InsuranceApply insuranceApply) {
+        if(insuranceApply.getId() == null ||StringUtils.isBlank(insuranceApply.getCheckInfo())){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        InsuranceApply model = insuranceApplyMapper.selectById(insuranceApply.getId());
+
+        if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        InsuranceApply update = new InsuranceApply();
+        update.setEditDate(new Date());
+        update.setEditor(user.getId());
+        update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo(insuranceApply.getCheckInfo());
+        update.setCheckUserId(user.getId());
+        update.setId(model.getId());
+        insuranceApplyMapper.updateById(update);
+
+        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.PLATFORM_RETURN;
+        String info =applyLogType.getInfo();
+        info = info.replace("${param}", update.getCheckInfo());
+        ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),null,null);
+        applyLogMapper.insert(log);
+        return  null;
+
+    }
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer uploadBaoxiandan(InsuranceApply insuranceApply) {
+        return  null;
+
+    }
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer refuseBackApply(InsuranceApply insuranceApply) {
+        return  null;
+
+    }
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer uploadToubaodan(InsuranceApply insuranceApply) {
+        return  null;
+
+    }
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer check(InsuranceApply insuranceApply) {
+        return  null;
+
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public Integer create(InsuranceApply insuranceApply) {
         if (Objects.isNull(insuranceApply)
             || Objects.isNull(insuranceApply.getSolutionId())
@@ -143,7 +203,7 @@
             }
             applyDetail.setIdcardNo(member.getIdcardNo());
             applyDetail.setSex(member.getSex());
-            applyDetail.setFee(this.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime()));
+            applyDetail.setFee(Constants.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime()));
             //楠岃瘉娲鹃仯鍗曚綅淇℃伅鏄惁瀛樺湪
             if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){
                 throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"銆�"+applyDetail.getMemberName()+"銆戝憳宸ユ淳閬e崟浣嶆湭鏌ヨ鍒帮紒");
@@ -169,21 +229,21 @@
         applyLog.setTitle(insuranceApplyStatus.getName());
         applyLog.setContent(content);
         applyLog.setObjType(insuranceApplyStatus.getKey());
-        applyLog.setObjId(Integer.toString(insuranceApply.getId()));
+        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 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");
@@ -319,6 +379,21 @@
         insuranceApply.setInsureNum(applyDetailMapper.selectCount(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())
                 .eq(ApplyDetail::getIsdeleted,Constants.ZERO)));
 
+        //璁剧疆鍦ㄤ繚鏃堕暱锛堝ぉ鏁帮級
+        if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())){
+            //濡傛灉褰撳墠鏃堕棿澶т簬缁撴潫鏃ユ湡 鍒欎娇鐢ㄧ粨鏉熸棩鏈熷姣斿紑濮嬫棩鏈�
+            if(DateUtil.compareDate(new Date(),insuranceApply.getEndTime())>=Constants.ZERO){
+                insuranceApply.setServiceDays(DateUtil.daysBetweenDates(insuranceApply.getEndTime(),insuranceApply.getStartTime()));
+            }else if(DateUtil.compareDate(insuranceApply.getStartTime(),new Date())>=Constants.ZERO){
+                //鏈紑濮�
+                insuranceApply.setServiceDays(Constants.ZERO);
+            }else{
+                insuranceApply.setServiceDays(DateUtil.daysBetweenDates(new Date(),insuranceApply.getStartTime()));
+            }
+        }
+
+
+
         //鏌ヨ鎿嶄綔璁板綍
         List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class,
                 new MPJLambdaWrapper<ApplyLog>()

--
Gitblit v1.9.3