Explorar o código

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

Qchen hai 1 ano
pai
achega
4e38a71c3a

+ 1 - 1
src/main/java/com/ydtech/constants/InsuranceEnum.java

@@ -85,7 +85,7 @@ public enum InsuranceEnum {
     ZSIC("ZSIC", "浙商财产保险股份有限公司", ""),
     ZYBX("ZYBX", "中原农业保险股份有限公司", ""),
     ZYIC("ZYIC", "中意财产保险有限公司", ""),
-    SNPIC("SNPIC", "申能财产保险股份有限公司", "");
+    SNBX("SNBX", "申能财产保险股份有限公司", "shenneng");
 
     private final String code;
 

+ 9 - 1
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -1572,7 +1572,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         insPlyIncome.setJqOtherCostsProportion(insPlyIncomeVo.getJqOtherCostsProportion());
                     }
 
-                    if (syNoTaxPremium != null && insPlyIncomeVo.getSyOtherCostsProportion() != null && insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    if (syNoTaxPremium != null && insPlyIncomeVo.getSyOtherCostsProportion() != null ) {
                         insPlyIncome.setSyOtherCostsProportion(insPlyIncome.getSyOtherCostsProportion());
                         insPlyIncome.setSyOtherCostsPremium(getBigDecimal(syNoTaxPremium, insPlyIncomeVo.getSyOtherCostsProportion()));
                     }
@@ -1585,6 +1585,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 }
             }
 
+            BigDecimal dividedAmount = jqNoTaxPremium.divide(new BigDecimal("1.06"), 5, BigDecimal.ROUND_DOWN);
+            insPlyIncome.setJqNoTaxPremium(dividedAmount);
+            BigDecimal taxPremium = insPlyIncome.getTaxPremium();
+            BigDecimal noTaxPremium = taxPremium.divide(new BigDecimal("1.06"), 5, BigDecimal.ROUND_DOWN);
+            insPlyIncome.setNoTaxPremium(noTaxPremium);
+
 
             if ("0".equals(insPlyIncomeVo.getIsNotDocumentary()) && "0".equals(insPlyIncomeVo.getIsNotCar())) {  //保险  手续费 =不含税保费* 手续费比例
                 insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(), insPlyIncome.getSySuperviseCostsPremiums(), null)); // 手续费
@@ -1594,6 +1600,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 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));  // 非车手续费

+ 37 - 0
src/main/java/com/ydtech/modules/order/components/FileComponents.java

@@ -6,6 +6,7 @@ import net.lingala.zip4j.core.ZipFile;
 import net.lingala.zip4j.exception.ZipException;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
@@ -77,6 +78,42 @@ public class FileComponents {
         }
     }
 
+    public String gainCarInsPolicyNew(MultipartFile file, String subOrderId, boolean flag) {
+        try {
+            String dir = uploadFilePath + "carInsPolicyNew/" + subOrderId + "/";
+            String showPath = apiUrl + showFileUrl + "carInsPolicyNew/" + subOrderId + "/" + file.getOriginalFilename();
+
+            File existFile = new File(dir + file.getOriginalFilename());
+            if (existFile.exists()) {
+                if (!flag) {
+                    return showPath; // 已存在且不要求覆盖
+                } else {
+                    existFile.delete(); // 删除旧文件
+                }
+            }
+
+            File folder = new File(dir);
+            if (!folder.isDirectory()) {
+                folder.mkdirs();
+            }
+
+            // 将上传的文件保存到本地
+            File destFile = new File(dir + file.getOriginalFilename());
+            file.transferTo(destFile);
+
+            return showPath;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new SystemException("文件上传异常");
+        }
+    }
+
+//    public static boolean uploadCarInsPolicyNew(MultipartFile file, String fileName, String subOrderId, boolean flag) {
+//        FileComponents fileComponents = new FileComponents();
+//        String policyPath = fileComponents.gainCarInsPolicyNew(file, fileName, subOrderId, flag);
+//        return true;
+//    }
+
     public static void unzipFile(String url, String zipPath, String zipName, String password, String newFileName) throws ZipException,
             IOException {
         String path = zipPath + zipName;

+ 16 - 0
src/main/java/com/ydtech/modules/order/controller/InsAreaCompanyController.java

@@ -17,6 +17,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
@@ -165,4 +166,19 @@ public class InsAreaCompanyController {
         List<InsOrderPayDateRecord> list=insOrderPayDateRecordService.updateOrderDateRecord(subOrderId);
         return HttpResult.ok(list);
     }
+
+    @PostMapping("/uploadInsurancePolicy")
+    @ApiOperation("手动上传保单")
+    public HttpResult<String> uploadInsurancePolicy(@RequestParam("subOrderId") String subOrderId,
+                                                    @RequestParam("policyType") String policyType,
+                                                    @RequestParam("file") MultipartFile file) {
+        if(subOrderId.contains(",")){
+            subOrderId = subOrderId.replaceAll(",","");
+        }
+        if(policyType.contains(",")){
+            policyType = policyType.replaceAll(",","");
+        }
+        insOrderPdfUrlService.uploadInsurancePolicy(file,policyType,subOrderId,true);
+        return HttpResult.ok("上传成功",file.getOriginalFilename());
+    }
 }

+ 3 - 0
src/main/java/com/ydtech/modules/order/service/InsOrderPdfUrlService.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.order.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.order.entity.po.InsOrderPdfUrl;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
 * @author Administrator
@@ -24,4 +25,6 @@ public interface InsOrderPdfUrlService extends IService<InsOrderPdfUrl> {
      *  @Description:
      */ 
     ReadPdfUrlListDto productOrderPdf(String subOrderId);
+
+    String uploadInsurancePolicy(MultipartFile file, String policyType, String subOrderId, boolean flag);
 }

+ 3 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -959,6 +959,8 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         //处理子订单重新赋值   add  by hxl  2024-07-01  处理编辑数据不更新的bug
         InsAreaCompany insAreaCompany = insOrdersEditingVo.getInsAreaCompanyList().get(0);
         insAreaCompany = getNewEntity(insAreaCompany, insOrdersEditingVo, ptlAgreement);
+        // 更新对接人
+        insAreaCompany.setDockingPerson(ptlAgreement.getDockingPerson());
         this.updateById(insAreaCompany);
 
         // add  by  hxl   2025-01-09 添加外部订单的维护人
@@ -969,6 +971,7 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
             insAreaCompany.setLeaderId(sysUser.getLeaderId());
             insAreaCompany.setLeaderName(sysUser.getLeaderName());
         }
+
         //更新轨迹表
         // if(insOrdersEditingVo.getStageFlag()==1){
         insOrdersTrackService.addingTrajectories(insAreaCompany);

+ 2 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -1078,6 +1078,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             // 将返回参数放入redis
             redisTemplate.opsForValue().set(InsuranceEnum.TSBX.getCode()+OrderCacheConstant.BS_ACCESS_TOKEN + attributionDto.getUsername(), JSON.toJSONString(tsResponse.getData()), OrderCacheConstant.TS_ACCESS_TOKEN_TIME,
                     TimeUnit.SECONDS);
+            response = (JSONObject) JSON.toJSON(tsResponse);
         }
         // 诚泰发送验证码
         if (attribution.getInsCompanyId().equals("CHAC1000000")){
@@ -1088,7 +1089,7 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
             crawlerLoginRequest.setCheck("zs");
             response = insCrawlerOrderComponents.request(apiUrl, InsuranceEnum.CHAC.getCode(), "获取验证码",
                     crawlerLoginRequest, JSONObject.class);
-            if (!response.getInteger("code").equals(400)) {
+            if (!response.getInteger("code").equals(200)) {
                 throw new SystemException(response.getString("message"));
             }
             // 将返回参数放入redis

+ 62 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPdfUrlServiceImpl.java

@@ -1,9 +1,11 @@
 package com.ydtech.modules.order.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.InsuranceEnum;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.components.FileComponents;
 import com.ydtech.modules.order.dao.InsOrderPdfUrlMapper;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompanyExternalPolicy;
@@ -16,6 +18,7 @@ import com.ydtech.utils.OrderUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -82,6 +85,9 @@ public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper,
     @Autowired
     private YangGuangOrderApiService yangGuangOrderApiService;
 
+    @Autowired
+    private FileComponents fileComponents;
+
 
     /**
      *  @version
@@ -136,6 +142,62 @@ public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper,
         return readPdfUrlList(subOrderId,true);
     }
 
+    @Override
+    public String uploadInsurancePolicy(MultipartFile file, String policyType, String subOrderId, boolean flag) {
+        boolean existsFlag = true;
+        String policyPath = fileComponents.gainCarInsPolicyNew(file, subOrderId, flag);
+        if(StringUtils.isBlank(policyPath)){
+            throw  new SystemException("文件上传失败");
+        }
+        // pdf 表中插入数据
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderId);
+        if(Objects.isNull(insAreaCompany)){
+            throw new SystemException("订单不存在");
+        }
+        InsOrderPdfUrl entityBySubOrderId = insOrderPdfUrlMapper.findEntityBySubOrderId(subOrderId);
+        if(Objects.isNull(entityBySubOrderId)){
+            existsFlag = false;
+            // 创建一个新的数据
+            entityBySubOrderId = new InsOrderPdfUrl();
+            entityBySubOrderId.setSubOrderNo(subOrderId);
+            entityBySubOrderId.setRiskCode(insAreaCompany.getProduct());
+        }
+        if (policyType.equals("1")) {
+            if(insAreaCompany.getJqapplyno().equals("")){
+                throw new SystemException("未查询到交强保单号");
+            }
+            entityBySubOrderId.setJqNo(insAreaCompany.getJqapplyno());
+            entityBySubOrderId.setJqUrl(policyPath);
+        }
+        if (policyType.equals("2")){
+            if(insAreaCompany.getJqapplyno().equals("")){
+                throw new SystemException("未查询到交强保单号");
+            }
+            entityBySubOrderId.setJqNo(insAreaCompany.getJqapplyno());
+            entityBySubOrderId.setJqSignUrl(policyPath);
+        }
+        if (policyType.equals("3")){
+            if(insAreaCompany.getSyapplyno().equals("")){
+                throw new SystemException("未查询到商业保单号");
+            }
+            entityBySubOrderId.setSyNo(insAreaCompany.getSyapplyno());
+            entityBySubOrderId.setSyUrl(policyPath);
+        }
+        if (policyType.equals("4")){
+            if (insAreaCompany.getCrossInsurance().size() > 0) {
+                entityBySubOrderId.setJyNo(((JSONObject) insAreaCompany.getCrossInsurance().get(0)).getString("application"));
+                entityBySubOrderId.setJyUrl(policyPath);
+            }else{
+                throw new SystemException("未查询到驾意保单号");
+            }
+        }
+        if(!existsFlag) {
+            insOrderPdfUrlMapper.insert(entityBySubOrderId);
+        }else{
+            insOrderPdfUrlMapper.updateById(entityBySubOrderId);
+        }
+        return policyPath;
+    }
 
 
     public  ReadPdfUrlListDto  insertOrderPdfData(InsAreaCompany subOrder,InsOrders insOrders,boolean flag,InsOrderPdfUrl jqUrlEntity){

+ 11 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -1921,7 +1921,17 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setRiskCode(byProjectCode.getRiskCode());
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setQuantity(baseQuoteVo.getAccidentalDrivingVo().getQuantity());
             return guoRenBaseQuoteVo;
-        } else if (baseQuoteVo.getCompanyId().equals("ZAPA1000000")) {
+        } else if (baseQuoteVo.getCompanyId().equals("SNBX1000000")){
+            BaseQuoteVo<Object> shennengBaseQuoteVo = new BaseQuoteVo<>();
+            BeanUtils.copyProperties(baseQuoteVo, shennengBaseQuoteVo);
+            JSONObject accidentalDrivingVo = new JSONObject();
+            InsDrivingIntentionInsurance byProjectCode = insDrivingIntentionInsuranceService.getByProjectCode(baseQuoteVo.getCompanyId(), baseQuoteVo.getAccidentalDrivingVo().getProjectCode());
+            accidentalDrivingVo.put("code", byProjectCode.getProjectCode());
+            accidentalDrivingVo.put("name", baseQuoteVo.getAccidentalDrivingVo().getProjectName());
+            accidentalDrivingVo.put("quantity", baseQuoteVo.getAccidentalDrivingVo().getQuantity());
+            shennengBaseQuoteVo.setAccidentalDrivingVo(accidentalDrivingVo);
+            return shennengBaseQuoteVo;
+        }else if (baseQuoteVo.getCompanyId().equals("ZAPA1000000")) {
             //众安
             BaseQuoteVo<Object> zhongAnBaseQuoteVo = new BaseQuoteVo<>();
             BeanUtils.copyProperties(baseQuoteVo, zhongAnBaseQuoteVo);