| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338 |
- package com.ydtech.modules.fnc.service.impl;
- import cn.afterturn.easypoi.excel.entity.ExportParams;
- import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
- import cn.hutool.core.bean.BeanUtil;
- import cn.hutool.core.text.StrBuilder;
- import com.alibaba.fastjson.JSONArray;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.fasterxml.jackson.core.JsonProcessingException;
- import com.fasterxml.jackson.databind.JsonNode;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import com.ydtech.constants.enums.dict.agreement.ProductsType;
- import com.ydtech.core.page.HttpResult;
- import com.ydtech.exception.SystemException;
- import com.ydtech.modules.esm.model.EsmInsCompany;
- import com.ydtech.modules.esm.service.EsmInsCompanyService;
- import com.ydtech.modules.fnc.entity.InsAreaCompany;
- import com.ydtech.modules.fnc.entity.InsPlyIncome;
- import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
- import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
- import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
- import com.ydtech.modules.fnc.service.InsPlyIncomeService;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
- import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
- import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
- import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
- import com.ydtech.modules.ins.model.vo.res.*;
- import com.ydtech.modules.inv.model.InvChannelsExternalBillsDetails;
- import com.ydtech.modules.inv.model.dto.InsBxNoPlyIncomeExcelDto;
- import com.ydtech.modules.inv.model.dto.InsBxPlyIncomeExcelDto;
- import com.ydtech.modules.inv.model.dto.InsPlyIncomeExcelDto;
- import com.ydtech.modules.inv.model.dto.InvChannelExcelDto;
- import com.ydtech.modules.inv.model.excel.InvDisburseExcel;
- import com.ydtech.modules.inv.utils.EasyExcelUtils;
- import com.ydtech.modules.order.entity.BasePageResult;
- import com.ydtech.modules.order.entity.InsOrders;
- import com.ydtech.modules.order.service.InsAreaCompanyService;
- import com.ydtech.modules.order.service.InsOrdersService;
- import com.ydtech.modules.protocol.entity.po.PtlAgreement;
- import com.ydtech.modules.protocol.entity.vo.PtlAgreementQueryVo;
- import com.ydtech.modules.protocol.service.PtlAgreementService;
- import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
- import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
- import com.ydtech.utils.SnowFlakeUtil;
- import com.ydtech.utils.excel.ExcelEasypoiUtils;
- import com.ydtech.utils.excel.ExcelStyleUtil;
- import com.ydtech.utils.excel.ExcelUtils2;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.commons.lang3.ObjectUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.poi.ss.formula.functions.Now;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.context.annotation.Lazy;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.util.CollectionUtils;
- import org.springframework.web.multipart.MultipartFile;
- import redis.clients.jedis.params.Params;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.awt.image.BandedSampleModel;
- import java.io.IOException;
- import java.math.BigDecimal;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.time.LocalDate;
- import java.time.LocalDateTime;
- import java.util.*;
- import java.util.stream.Collectors;
- /**
- * <p>
- * 保司结算手续费 服务实现类
- * </p>
- *
- * @author gws
- * @since 2024-01-05
- */
- @Slf4j
- @Service
- public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, InsPlyIncome> implements InsPlyIncomeService {
- @Autowired
- @Lazy
- private InsOrdersService insOrdersService;
- @Autowired
- private InsAreaCompanyService insAreaCompanyService;
- @Autowired
- private InsFeeOrderNewService insFeeOrderNewService;
- @Autowired
- private SettlementDocumentaryFeesService settlementDocumentaryFeesService;
- @Autowired
- private SettlementDocumentaryLogService settlementDocumentaryLogService;
- @Autowired
- private PtlAgreementService ptlAgreementService;
- @Autowired
- private EsmInsCompanyService EsmInsCompanyService;
- @Value("${upload.file.path}")
- private String uploadPath;
- @Value("${upload.file.url}")
- private String uploadUrl;
- public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo){
- try{
- Page<InsOrders> page = new Page<>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize());
- PageInfo<List<InsPlyIncome>> pageHelper = null;
- PageHelper.startPage(insPlyIncomeVo.getPageNum(),insPlyIncomeVo.getPageSize());
- List<InsPlyIncome> list= this.baseMapper.selectByCondition(insPlyIncomeVo);
- pageHelper=new PageInfo(list);
- BasePageResult<InsPlyIncome> pageResult=new BasePageResult<InsPlyIncome>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
- return HttpResult.ok(pageResult);
- }catch (Exception e){
- e.printStackTrace();
- return HttpResult.error("查询异常");
- }
- }
- @Override
- public void saveBalanceNew(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
- if (ObjectUtils.isEmpty(order) || ObjectUtils.isEmpty(insFeeOrderNew) || ObjectUtils.isEmpty(insAreaCompany)) {
- return;
- }
- String agreeType = this.judgeAgreeType(insAreaCompany.getAgreementId());
- if (StringUtils.isNotEmpty(agreeType)) {
- // 判断协议类型 平台 保险
- if ("1".equals(agreeType)) {
- this.savePinTai(order,insFeeOrderNew,insAreaCompany); //手续费不分非车不非车 跟单也不分
- }else { // 保险 逻辑: 手续费生成一条 跟单费生成一条 非车手续费一条 非车跟单费一条
- if (((insFeeOrderNew.getJqSuperviseCostsPremiums() != null && insFeeOrderNew.getJqSuperviseCostsPremiums().compareTo(BigDecimal.ZERO) != 0)) || (insFeeOrderNew.getSySuperviseCostsPremiums() != null && insFeeOrderNew.getSySuperviseCostsPremiums().compareTo(BigDecimal.ZERO) != 0)) { //手续费
- this.saveInsuranceProcedures(order,insFeeOrderNew,insAreaCompany);
- }
- if(insFeeOrderNew.getJqOtherCostsPremiums()!=null && insFeeOrderNew.getJqOtherCostsPremiums().compareTo(BigDecimal.ZERO) != 0){ //跟单费
- this.saveOtherAmount(order,insFeeOrderNew,insAreaCompany);
- }
- if(insFeeOrderNew.getNoSuperviseCostsPremiums() !=null && insFeeOrderNew.getNoSuperviseCostsPremiums().compareTo(BigDecimal.ZERO) != 0) { // 非车手续费
- this.saveNoSupervise(order,insFeeOrderNew,insAreaCompany);
- }
- if(insFeeOrderNew.getNoOtherCostsPremiums() !=null && insFeeOrderNew.getNoOtherCostsPremiums().compareTo(BigDecimal.ZERO) != 0){ // 非车跟单费
- this.saveNoOtherAmount(order,insFeeOrderNew,insAreaCompany);
- }
- }
- }
- }
- private void saveNoOtherAmount(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
- String noPolicyno = this.setNoPolicyno(insAreaCompany);
- if(StringUtils.isNotEmpty(noPolicyno)){
- insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
- }
- insPlyIncome.setOtherFeevalue(insFeeOrderNew.getNoOtherCostsPremiums()); //非车跟单费
- insPlyIncome.setOtherFeerate(insFeeOrderNew.getNoOtherCostsProportion()); //非车跟单费用比例
- insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
- this.saveRiskCode(order.getProductid(),insPlyIncome);
- insPlyIncome.setPayDate(insAreaCompany.getPayDate());
- insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
- insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
- insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
- insPlyIncome.setLicenseno(order.getLicenseno());
- insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
- insPlyIncome.setCreateTime(LocalDate.now());
- insPlyIncome.setDocumentaryFeesStatus("0");
- insPlyIncome.setHandlingFeesStatus("0");
- insPlyIncome.setNoNoTaxPremium(insPlyIncome.getNoNoTaxPremium());
- insPlyIncome.setNoPremium(insPlyIncome.getNoPremium());
- insPlyIncome.setIsNotCar("1");
- insPlyIncome.setIsNotDocumentary("1");
- insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoOtherCostsPremiums());
- this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
- baseMapper.insert(insPlyIncome);
- }
- private void saveNoSupervise(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
- insPlyIncome.setCommissionFeevalue(insFeeOrderNew.getNoSuperviseCostsPremiums());// 非车手续费
- insPlyIncome.setCommissionFeerate(insFeeOrderNew.getNoSuperviseCostsProportion());// 非车手续费比例
- String noPolicyno = this.setNoPolicyno(insAreaCompany);
- if(StringUtils.isNotEmpty(noPolicyno)){
- insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
- }
- insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
- this.saveRiskCode(order.getProductid(),insPlyIncome);
- insPlyIncome.setPayDate(insAreaCompany.getPayDate());
- insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
- insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
- insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
- insPlyIncome.setLicenseno(order.getLicenseno());
- insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
- insPlyIncome.setCreateTime(LocalDate.now());
- insPlyIncome.setDocumentaryFeesStatus("0");
- insPlyIncome.setHandlingFeesStatus("0");
- insPlyIncome.setIsNotCar("1");
- insPlyIncome.setIsNotDocumentary("0");
- insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoSuperviseCostsPremiums());
- insPlyIncome.setUserId(insFeeOrderNew.getUserId());
- insPlyIncome.setInsuredName(order.getInsuredname());
- insPlyIncome.setNoPremium(insFeeOrderNew.getNoPremium()); //非车保费
- insPlyIncome.setNoNoTaxPremium(insFeeOrderNew.getNoNoTaxPremium()); //非车不含税保费
- this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
- baseMapper.insert(insPlyIncome);
- }
- private void saveRiskCode(String productid,InsPlyIncome insPlyIncome) {
- if(ProductsType.PT_0330.getCode().equals(productid)){
- insPlyIncome.setRiskcode(ProductsType.PT_0330.getDesc());
- }
- if(ProductsType.PT_034001.getCode().equals(productid)){
- insPlyIncome.setRiskcode(ProductsType.PT_034001.getDesc());
- }
- if(ProductsType.PT_034002.getCode().equals(productid)){
- insPlyIncome.setRiskcode(ProductsType.PT_034002.getDesc());
- }
- if(ProductsType.PT_0330034002.getCode().equals(productid)){
- insPlyIncome.setRiskcode(ProductsType.PT_0330034002.getDesc());
- }
- if(ProductsType.PT_0330034001.getCode().equals(productid)){
- insPlyIncome.setRiskcode(ProductsType.PT_0330034001.getDesc());
- }
- }
- private void saveOtherAmount(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
- BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(),null);
- BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getJqOtherCostsProportion(),null);
- BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), null); //交强不含税保费
- BigDecimal allPremium = this.calculateTotal(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getSyPremium(), null);// 总保费
- InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getId(),insAreaCompany.getJqpolicyno(),insAreaCompany.getSypolicyno(),null,null,insFeeOrderNew.getDeptId(),null,order.getProductid(),insAreaCompany.getPayDate(),insAreaCompany.getSigningTime(),insAreaCompany.getCompanyId(),null,insFeeOrderNew.getAgreementId(),order.getLicenseno(),insAreaCompany.getTaxamount(),
- allNoTaxPremium,null,otherProportion,null,otherAmount,otherAmount,null,null,LocalDate.now(),null,null,null,"0","0","0","1");
- this.saveRiskCode(order.getProductid(),insPlyIncome);
- insPlyIncome.setTaxPremium(allPremium);
- insPlyIncome.setJqPremium(insFeeOrderNew.getJqPremium());
- insPlyIncome.setSyPremium(insFeeOrderNew.getSyPremium());
- insPlyIncome.setJqNoTaxPremium(insFeeOrderNew.getJqNoTaxPremium());
- insPlyIncome.setSyNoTaxPremium(insFeeOrderNew.getSyNoTaxPremium());
- insPlyIncome.setJqOtherCostsProportion(insFeeOrderNew.getJqOtherCostsProportion()); //交强跟单费比例
- insPlyIncome.setSyOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion()); //商业跟单费比例
- insPlyIncome.setSyOtherCostsPremium(insFeeOrderNew.getSyOtherCostsPremiums());
- insPlyIncome.setJqOtherCostsPremium(insFeeOrderNew.getJqOtherCostsPremiums());
- insPlyIncome.setUserId(insFeeOrderNew.getUserId());
- insPlyIncome.setInsuredName(order.getInsuredname());
- this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
- baseMapper.insert(insPlyIncome);
- }
- private void saveInsuranceProcedures(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
- // 保险手续费
- BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums(),null);
- BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion(),null);
- BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), null);//不含税保费
- InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getId(),insAreaCompany.getJqpolicyno(),insAreaCompany.getSypolicyno(),null,null,insFeeOrderNew.getDeptId(),null,order.getProductid(),insAreaCompany.getPayDate(),insAreaCompany.getSigningTime(),insAreaCompany.getCompanyId(),null,insFeeOrderNew.getAgreementId(),order.getLicenseno(),insAreaCompany.getTaxamount()
- ,allNoTaxPremium,handlingProportion,null,handlingAmount,null,handlingAmount,null,null,LocalDate.now(),null,null,null,"0","0","0","0");
- BigDecimal allTaxPremium = this.calculateTotal(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getSyPremium(), null);
- insPlyIncome.setJqPremium(insFeeOrderNew.getJqPremium());
- insPlyIncome.setSyPremium(insFeeOrderNew.getSyPremium());
- insPlyIncome.setJqNoTaxPremium(insFeeOrderNew.getJqNoTaxPremium());
- insPlyIncome.setSyNoTaxPremium(insFeeOrderNew.getSyNoTaxPremium());
- insPlyIncome.setJqSuperviseCostsProportion(insFeeOrderNew.getJqSuperviseCostsProportion());
- insPlyIncome.setJqSuperviseCostsPremiums(insFeeOrderNew.getJqSuperviseCostsPremiums());
- insPlyIncome.setSySuperviseCostsProportion(insFeeOrderNew.getSySuperviseCostsProportion());
- insPlyIncome.setSySuperviseCostsPremiums(insFeeOrderNew.getSySuperviseCostsPremiums());
- this.saveRiskCode(order.getProductid(),insPlyIncome);
- insPlyIncome.setTaxPremium(allTaxPremium);
- insPlyIncome.setUserId(insFeeOrderNew.getUserId());
- insPlyIncome.setInsuredName(order.getInsuredname());
- this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
- baseMapper.insert(insPlyIncome);
- }
- private String setNoPolicyno(com.ydtech.modules.fnc.entity.InsAreaCompany insAreaCompany) {
- String crossInsurance = insAreaCompany.getCrossInsurance();
- if (StringUtils.isEmpty(crossInsurance)) {
- return null;
- }
- try {
- ObjectMapper objJson = new ObjectMapper();
- JsonNode jsonArryNode = objJson.readTree(crossInsurance);
- if (jsonArryNode.isArray() && jsonArryNode.size() > 0) {
- JsonNode firstNode = jsonArryNode.get(0);
- JsonNode policyNumberNode = firstNode.get("policyNumber");
- if (policyNumberNode != null) {
- return policyNumberNode.asText();
- } else {
- return firstNode.get("policy").asText();
- }
- }
- } catch (IOException e) {
- e.printStackTrace(); // 可以打印异常信息
- }
- return null;
- }
- private void savePinTai(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
- BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums(),insFeeOrderNew.getNoSuperviseCostsPremiums()); //手续费
- BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion(),insFeeOrderNew.getNoSuperviseCostsProportion());//手续费比例
- BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(),insFeeOrderNew.getNoOtherCostsPremiums());//跟单费
- BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getJqOtherCostsProportion(),insFeeOrderNew.getNoOtherCostsProportion()); //跟单费比例
- // 不含税保费
- BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), insFeeOrderNew.getNoNoTaxPremium());
- BigDecimal allAmount = this.calculateTotal(otherAmount, handlingAmount, null);
- BigDecimal jqReceivableProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getNoSuperviseCostsProportion(), null);// 交强应收 比例
- BigDecimal syReceivableProportion = this.calculateTotal(insFeeOrderNew.getSySuperviseCostsProportion(), insFeeOrderNew.getSyOtherCostsProportion(), null);//商业应收比例
- BigDecimal noReceivableProportion = this.calculateTotal(insFeeOrderNew.getNoSuperviseCostsProportion(), insFeeOrderNew.getNoOtherCostsProportion(), null);
- String noPolicyno = this.setNoPolicyno(insAreaCompany);
- InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getId(),insAreaCompany.getJqpolicyno(),insAreaCompany.getSypolicyno(),
- noPolicyno,null,insFeeOrderNew.getDeptId(), null,order.getProductid(),insAreaCompany.getPayDate(),insAreaCompany.getSigningTime(),insAreaCompany.getCompanyId(),
- null,insFeeOrderNew.getAgreementId(),order.getLicenseno(),insAreaCompany.getTaxamount(),allNoTaxPremium,handlingProportion,
- otherProportion,handlingAmount,otherAmount,allAmount,null,null,LocalDate.now(),null,null,null,"0","0","0","0");
- insPlyIncome.setJqReceivableProportion(jqReceivableProportion);
- insPlyIncome.setSyReceivableProportion(syReceivableProportion);
- insPlyIncome.setNoReceivableProportion(noReceivableProportion);
- // 应收金额 = 商业手续费+商业跟单 + 交强手续费 +交强跟单费 + 非车手续费 + 非车跟单费 = allAmount
- insPlyIncome.setJqSuperviseCostsPremiums(insFeeOrderNew.getJqSuperviseCostsPremiums()); // 交强手续费
- insPlyIncome.setSySuperviseCostsPremiums(insFeeOrderNew.getSySuperviseCostsPremiums()); // 商业手续费
- insPlyIncome.setNoSuperviseCostsPremiums(insFeeOrderNew.getNoSuperviseCostsPremiums()); // 非车手续费
- insPlyIncome.setJqSuperviseCostsProportion(insFeeOrderNew.getJqSuperviseCostsProportion()); //交强手续费 比例
- insPlyIncome.setSySuperviseCostsProportion(insFeeOrderNew.getSySuperviseCostsProportion()); // 商业手续费 比例
- insPlyIncome.setNoSuperviseCostsProportion(insFeeOrderNew.getNoSuperviseCostsProportion());// 非车手续费 比例
- insPlyIncome.setJqOtherCostsProportion(insFeeOrderNew.getJqOtherCostsProportion()); //交强跟单费比例
- insPlyIncome.setSyOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion()); //商业跟单费比例
- insPlyIncome.setNoOtherCostsProportion(insFeeOrderNew.getNoOtherCostsProportion()); //非车跟单费比例
- insPlyIncome.setUserId(insFeeOrderNew.getUserId());
- insPlyIncome.setInsuredName(order.getInsuredname());
- this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
- baseMapper.insert(insPlyIncome);
- }
- private void saveByCompanyId(InsFeeOrderNew insFeeOrderNew,String companyId, InsPlyIncome insPlyIncome) {
- PtlAgreement ptlAgreementQueryVo = this.ptlAgreementService.getByAgreementIdNew(insFeeOrderNew.getAgreementId());
- if(ObjectUtils.isNotEmpty(ptlAgreementQueryVo)){
- if(StringUtils.isNotEmpty(ptlAgreementQueryVo.getPartnerCompaniesId())){
- // 合作公司id
- String partnerCompaniesId = ptlAgreementQueryVo.getPartnerCompaniesId();
- insPlyIncome.setPartnerCompaniesId(partnerCompaniesId);
- EsmInsCompany esmInsCompany = EsmInsCompanyService.getById(partnerCompaniesId);
- String name = esmInsCompany.getName(); //合作名称
- insPlyIncome.setPartnerCompaniesName(name);
- insPlyIncome.setPartnerCompaniesId(ptlAgreementQueryVo.getPartnerCompaniesId());
- }
- if(StringUtils.isNotEmpty(ptlAgreementQueryVo.getInsuranceCompanyId())){
- String insuranceCompanyId = ptlAgreementQueryVo.getInsuranceCompanyId();
- EsmInsCompany esmInsCompany = EsmInsCompanyService.getById(insuranceCompanyId);
- String name = esmInsCompany.getName(); //保险公司名称
- insPlyIncome.setCompanyName(name);
- }
- }
- }
- private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2, BigDecimal value3) {
- BigDecimal total = BigDecimal.ZERO;
- if (value1 != null) {
- total = total.add(value1);
- }
- if (value2 != null) {
- total = total.add(value2);
- }
- if (value3 != null) {
- total = total.add(value3);
- }
- return total;
- }
- private String judgeAgreeType(Long agreementId) {
- if (agreementId == null) {
- return null;
- }
- HttpResult<PtlAgreementQueryVo> byAgreementId = ptlAgreementService.getByAgreementId(agreementId.toString());
- if (byAgreementId != null && ObjectUtils.isNotEmpty(byAgreementId.getData())) {
- PtlAgreement agreement = byAgreementId.getData().getAgreement();
- String agreementType = agreement.getAgreementType();
- if (StringUtils.isNotEmpty(agreementType)) {
- return agreementType;
- }
- }
- return null;
- }
- public HttpResult<BasePageResult<InsPlyIncome>> queryNew(InsPlyIncomeVo insPlyIncomeVo){
- try{
- HashMap<String, Object> params = new HashMap<>();
- PageInfo<List<InsPlyIncome>> pageHelper = null;
- PageHelper.startPage(insPlyIncomeVo.getPageNum(),insPlyIncomeVo.getPageSize());
- params.put("pageNum",insPlyIncomeVo.getPageNum());
- params.put("pageSize",insPlyIncomeVo.getPageSize());
- params =this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> list= this.baseMapper.queryNew(params);
- pageHelper=new PageInfo(list);
- BasePageResult<InsPlyIncome> pageResult=new BasePageResult<InsPlyIncome>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
- return HttpResult.ok(pageResult);
- }catch (Exception e){
- e.printStackTrace();
- return HttpResult.error("查询异常");
- }
- }
- @Override
- public HashMap<String,Object> totalAmount(List<String> selectIds) {
- HashMap<String, Object> params = new HashMap<>();
- params.put("selectIds",selectIds);
- HashMap<String,Object> resultMap =baseMapper.totalAmount(params);
- return resultMap;
- }
- @Override
- @Transactional
- public HttpResult<Object> batchPinBalance(InsPlyIncomeVo insPlyIncomeVo) {
- if(!CollectionUtils.isEmpty(insPlyIncomeVo.getSelectIds())){
- List<String> selectIds = insPlyIncomeVo.getSelectIds();
- for(String id: selectIds){
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- insPlyIncome.setHandlingFeesStatus("1");
- insPlyIncome.setSettlementTime(LocalDate.now());
- insPlyIncome.setId(id);
- baseMapper.updateById(insPlyIncome);
- }
- }
- SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
- settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
- // settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
- settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue()); //跟单费金额
- settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getCommissionFeevalue()); //手续费金额
- settlementDocumentaryLogEntity.setCreateTime(new Date());
- settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
- return HttpResult.ok();
- }
- @Override
- public List<InsPlyIncome> totalPinAmount(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- params = this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> result=baseMapper.totalPinAmount(params);
- return result;
- }
- private HashMap<String, Object> saveParams(InsPlyIncomeVo insPlyIncomeVo, HashMap<String, Object> params) {
- if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getStartDate())){
- params.put("startDate",insPlyIncomeVo.getStartDate().toString());
- }
- if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getEndDate())){
- params.put("endDate",insPlyIncomeVo.getEndDate().toString());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getOrderno())){
- params.put("orderno",insPlyIncomeVo.getOrderno());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
- params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
- params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getAgreementType())){
- params.put("agreementType",insPlyIncomeVo.getAgreementType());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getLicenseno())){
- params.put("licenseno", insPlyIncomeVo.getLicenseno());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getUserId())){
- params.put("userId",insPlyIncomeVo.getUserId());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
- params.put("companyId",insPlyIncomeVo.getCompanyId());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getRiskcode())){
- params.put("riskcode",insPlyIncomeVo.getRiskcode());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getPolicyno())){
- params.put("policyno",insPlyIncomeVo.getPolicyno().split(","));
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getSyPolicyno())){
- params.put("syPolicyno",insPlyIncomeVo.getSyPolicyno().split(","));
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getNoPolicyno())){
- params.put("noPolicyno",insPlyIncomeVo.getNoPolicyno().split(","));
- }
- if(insPlyIncomeVo.getCreateTime()!=null){
- params.put("createTime",insPlyIncomeVo.getCreateTime());
- }
- if(insPlyIncomeVo.getSettlementTime()!=null){
- params.put("settlementTime",insPlyIncomeVo.getSettlementTime());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getHandlingFeesStatus())){
- params.put("handlingFeesStatus",insPlyIncomeVo.getHandlingFeesStatus());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getPartnerCompaniesId())){
- params.put("partnerCompaniesId",insPlyIncomeVo.getPartnerCompaniesId());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
- params.put("year",insPlyIncomeVo.getYear());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())){
- params.put("month",insPlyIncomeVo.getMonth());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getDay())){
- params.put("day",insPlyIncomeVo.getDay());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getSignDateEnd())){
- params.put("signDateEnd",insPlyIncomeVo.getSignDateEnd());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getSignDateStart())){
- params.put("signDateStart",insPlyIncomeVo.getSignDateStart());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyName())){
- params.put("companyName",insPlyIncomeVo.getCompanyName());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getInsuredName())){
- params.put("insuredName",insPlyIncomeVo.getInsuredName());
- }
- return params;
- }
- @Override
- public HttpResult<BasePageResult<InsPlyIncome>> nonSettlementQuery(InsPlyIncomeVo insPlyIncomeVo) {
- try{
- HashMap<String, Object> params = new HashMap<>();
- PageInfo<List<InsPlyIncome>> pageHelper = null;
- PageHelper.startPage(insPlyIncomeVo.getPageNum(),insPlyIncomeVo.getPageSize());
- params.put("pageNum",insPlyIncomeVo.getPageNum());
- params.put("pageSize",insPlyIncomeVo.getPageSize());
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
- params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
- params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
- params.put("year",insPlyIncomeVo.getYear());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())){
- params.put("month",insPlyIncomeVo.getMonth());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getDocumentaryFeesStatus())){
- params.put("documentaryFeesStatus",insPlyIncomeVo.getDocumentaryFeesStatus());
- }
- List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
- pageHelper=new PageInfo(list);
- BasePageResult<InsPlyIncome> pageResult=new BasePageResult<InsPlyIncome>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
- return HttpResult.ok(pageResult);
- }catch (Exception e){
- e.printStackTrace();
- return HttpResult.error("查询异常");
- }
- }
- @Override
- public HttpResult<List<InsPlyIncome>> nonSettldetail(InsPlyIncomeVo insPlyIncomeVo) {
- try {
- String ids = insPlyIncomeVo.getIds();
- ArrayList<InsPlyIncome> resultList = new ArrayList<>();
- if (ObjectUtils.isNotEmpty(ids)) {
- String[] split = ids.split(",");
- for (int i =0; i <split.length ; i++) {
- String id = split[i];
- resultList.add(this.baseMapper.getById(id));
- }
- }
- return HttpResult.ok(resultList);
- } catch (Exception e) {
- e.printStackTrace();
- return HttpResult.error("查询异常");
- }
- }
- @Override
- public void importData(MultipartFile multipartFile) {
- List<InsPlyIncome> list = null;
- HashMap<String, Object> params = new HashMap<>();
- try {
- List<InsPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsPlyIncomeExcelDto.class, 0, 1, 1);
- for (InsPlyIncomeExcelDto excelItem : dtoList) {
- params.clear();
- String licenseno = excelItem.getLicenseno();//车牌号
- params.put("licenseno",licenseno);
- String policyno = excelItem.getPolicyno(); //交强保单号
- params.put("policyno",policyno);
- String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
- params.put("syPolicyno",syPolicyno);
- String noPolicyno = excelItem.getNoPolicyno(); //非车保单号
- params.put("noPolicyno",noPolicyno);
- if(ObjectUtils.isNotEmpty(licenseno)){
- List<InsPlyIncome> insPlyIncome=baseMapper.findByLicenseno(params);
- for (InsPlyIncome item : insPlyIncome) {
- if(ObjectUtils.isNotEmpty(item)){
- item.setHandlingFeesStatus("1"); //已结算
- baseMapper.updateById(item);
- }
- }
- }
- }
- } catch (IOException e) {
- throw new SystemException("导入失败!");
- }
- }
- /**
- *
- * @param multipartFile
- * @return resultList 包含总金额 还有 未匹配表中的数据
- */
- @Override
- public HashMap<String, Object> bxImportData(MultipartFile multipartFile,String isNotCar) {
- BigDecimal totalAmount=BigDecimal.ZERO;
- HashMap<String, Object> params = new HashMap<>();
- ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
- HashMap<String, Object> resultMap = new HashMap<>();
- StringBuffer strBuilder = new StringBuffer();
- String ids="";
- try {
- List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
- if(!CollectionUtils.isEmpty(dtoList)){
- for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
- params.clear();
- if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
- String licenseno = excelItem.getLicenseno();//车牌号
- params.put("licenseno",licenseno);
- }
- if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
- String policyno = excelItem.getPolicyno(); //交强保单号
- params.put("policyno",policyno);
- }
- if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
- String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
- params.put("syPolicyno",syPolicyno);
- }
- // 只查手续费
- params.put("isOther","0");
- params.put("isNotCar",isNotCar);
- InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
- if(ObjectUtils.isNotEmpty(insPlyIncome)){ // 比配上汇总金额 未匹配则返回到数据当中
- strBuilder.append(insPlyIncome.getId()).append(",");
- if( insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
- totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue()); //添加总手续费
- }
- }else {
- HashMap<String, Object> noMatching = new HashMap<>();
- if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
- noMatching.put("licenseno",excelItem.getLicenseno());
- }
- if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
- noMatching.put("policyno",excelItem.getPolicyno());
- }
- if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
- noMatching.put("syPolicyno",excelItem.getSyPolicyno());
- }
- resultList.add(noMatching);
- }
- }
- }
- if(strBuilder.length() >0){
- ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
- }
- resultMap.put("ids",ids);
- resultMap.put("totalAmount",totalAmount);
- resultMap.put("resultList",resultList);
- return resultMap;
- } catch (IOException e) {
- throw new SystemException("导入失败!");
- }
- }
- @Override
- public HashMap<String, Object> bxImportNoData(MultipartFile multipartFile,String isNotCar) {
- BigDecimal totalAmount=BigDecimal.ZERO;
- HashMap<String, Object> params = new HashMap<>();
- HashMap<String, Object> resultMap = new HashMap<>();
- ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
- StringBuffer strBuilder = new StringBuffer();
- String ids="";
- try {
- List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
- if(!CollectionUtils.isEmpty(dtoList)){
- for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
- params.clear();
- if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
- String licenseno = excelItem.getLicenseno();//车牌号
- params.put("licenseno",licenseno);
- }
- if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
- String policyno = excelItem.getNoPolicyno(); //非车保单号
- params.put("NoPolicyno",policyno);
- }
- // 只查手续费
- params.put("isOther","0");
- params.put("isNotCar",isNotCar);
- InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
- if(ObjectUtils.isNotEmpty(insPlyIncome)){ // 比配上汇总金额 未匹配则返回到数据当中
- strBuilder.append(insPlyIncome.getId()).append(",");
- if( insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
- totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue()); //添加总手续费
- }
- }else {
- HashMap<String, Object> noMatching = new HashMap<>();
- if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
- noMatching.put("licenseno",excelItem.getLicenseno());
- }
- if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
- noMatching.put("NoPolicyno",excelItem.getNoPolicyno());
- }
- resultList.add(noMatching);
- }
- }
- if(strBuilder.length() >0){
- ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
- }
- resultMap.put("ids",ids);
- resultMap.put("totalAmount",totalAmount);
- resultMap.put("resultList",resultList);
- }
- return resultMap;
- } catch (IOException e) {
- throw new SystemException("导入失败!");
- }
- }
- @Override
- public HttpResult bxOtherDetailsExcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
- HashMap<String, Object> params = new HashMap<>();
- params =this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
- ExportParams exportParams = new ExportParams("保险跟单明细导出", null, ExcelType.HSSF);
- exportParams.setStyle(ExcelStyleUtil.class);
- List<BxOtherDetailsExcel> resultList = new ArrayList<>();
- for (InsPlyIncome item :insPlyIncomes){
- BxOtherDetailsExcel bxOtherDetailsExcel = new BxOtherDetailsExcel();
- BeanUtils.copyProperties(item, bxOtherDetailsExcel);
- resultList.add(bxOtherDetailsExcel);
- }
- String uploadPath = this.uploadPath + "/excel/";
- Path path = Paths.get(uploadPath);
- if (!Files.exists(path)) {
- try {
- Files.createDirectories(path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- String fileName = EasyExcelUtils.downExcel(uploadPath, "保险跟单明细导出", BxOtherDetailsExcel.class, resultList);
- return HttpResult.ok("",uploadUrl + "excel/" + fileName);
- }
- /**
- *
- * @param insPlyIncomeVo 传参字段
- * ids 通过ids中的id进行开票分组
- *
- * @return
- */
- @Override
- public HttpResult<List<HashMap<String,Object>>> invicdetail(InsPlyIncomeVo insPlyIncomeVo) {
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){
- String ids = insPlyIncomeVo.getIds();
- String[] idArr = ids.split(",");
- List<HashMap<String,Object>> result= this.baseMapper.groupByInvoic(idArr);
- return HttpResult.ok(result);
- }
- return HttpResult.ok();
- }
- /***
- *
- * @param insPlyIncomeVo
- * @param request
- * @param response
- * @return 保险非车跟单明细导出
- */
- @Override
- public HttpResult bxNoOtherDetailsExcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
- HashMap<String, Object> params = new HashMap<>();
- params =this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
- ExportParams exportParams = new ExportParams("保险非车跟单明细导出", null, ExcelType.HSSF);
- exportParams.setStyle(ExcelStyleUtil.class);
- List<BxNoOtherDetailsExcel> resultList = new ArrayList<>();
- for (InsPlyIncome item :insPlyIncomes){
- BxNoOtherDetailsExcel bxNoOtherDetailsExcel = new BxNoOtherDetailsExcel();
- BeanUtils.copyProperties(item, bxNoOtherDetailsExcel);
- resultList.add(bxNoOtherDetailsExcel);
- }
- String uploadPath = this.uploadPath + "/excel/";
- Path path = Paths.get(uploadPath);
- if (!Files.exists(path)) {
- try {
- Files.createDirectories(path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- String fileName = EasyExcelUtils.downExcel(uploadPath, "保险非车跟单明细导出", BxNoOtherDetailsExcel.class, resultList);
- return HttpResult.ok("",uploadUrl + "excel/" + fileName);
- }
- /**
- *
- * @param insPlyIncomeVo 开票ids
- * @return 返回开票号 开票金额 开票时间
- */
- @Override
- public HttpResult<List<HashMap<String, Object>>> otherSettldetail(InsPlyIncomeVo insPlyIncomeVo) {
- if (StringUtils.isNotEmpty(insPlyIncomeVo.getIncomeIds())) {
- String incomeIds = insPlyIncomeVo.getIncomeIds();
- List<HashMap<String, Object>> resultList = settlementDocumentaryFeesService.getOtherSettldetail(incomeIds);
- if (resultList.size() > 0) {
- return HttpResult.ok(resultList);
- }
- }
- return HttpResult.ok();
- }
- @Override
- @Transactional
- public void updateByEntity(InsPlyIncomeVo insPlyIncomeVo) {
- // 根据协议 如果是含增值税结算 用保费 * 如果是 不含税保费
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
- this.amountCalculate(insPlyIncomeVo,insPlyIncome);
- baseMapper.updateById(insPlyIncome);
- insPlyIncomeVo.setCrudStatus("2");
- this.saveLog(insPlyIncomeVo);
- }
- /**
- *
- * @param insPlyIncomeVo
- * @param insPlyIncome
- *
- * 重新计算金额 通过比例
- * 计算逻辑 交强不含税保费* 交强跟单比例 = 交强跟单金额
- */
- private void amountCalculate(InsPlyIncomeVo insPlyIncomeVo,InsPlyIncome insPlyIncome) {
- BigDecimal jqNoTaxPremium = insPlyIncomeVo.getJqNoTaxPremium();// 交强手续费 按照思路 交强不含税保费* 交强手续费比例 =交强手续费
- BigDecimal syNoTaxPremium = insPlyIncomeVo.getSyNoTaxPremium();// 商业手续费 按照思路 商业不含税保费* 商业手续费比例 =商业手续费
- BigDecimal noNoTaxPremium = insPlyIncomeVo.getNoNoTaxPremium();// 非车手续费 按照思路 非车不含税保费* 非车手续费比例 =非车手续费
- if(insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
- BigDecimal jqhandingFee = jqNoTaxPremium.multiply(insPlyIncomeVo.getJqSuperviseCostsProportion().divide(new BigDecimal(100)));
- insPlyIncome.setJqSuperviseCostsPremiums(jqhandingFee);
- }
- if(insPlyIncomeVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
- BigDecimal syhandingFee = syNoTaxPremium.multiply(insPlyIncomeVo.getSySuperviseCostsProportion().divide(new BigDecimal(100)));
- insPlyIncome.setSySuperviseCostsPremiums(syhandingFee);
- }
- if(insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
- BigDecimal nohandingFee = noNoTaxPremium.multiply(insPlyIncomeVo.getSySuperviseCostsProportion().divide(new BigDecimal(100)));
- insPlyIncome.setNoSuperviseCostsPremiums(nohandingFee);
- }
- if(insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
- BigDecimal jqother = jqNoTaxPremium.multiply(insPlyIncomeVo.getJqOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费 按照思路 交强不含税保费* 交强跟单比例 = 交强跟单金额
- insPlyIncome.setJqOtherCostsPremium(jqother);
- }
- if(insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
- BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getSyOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费 按照思路 交强不含税保费* 交强跟单比例 = 交强跟单金额
- insPlyIncome.setJqOtherCostsPremium(syother);
- }
- if(insPlyIncomeVo.getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
- BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getNoOtherCostsProportion().divide(new BigDecimal(100)));//非车跟单费 按照思路 非车不含税保费* 非车跟单比例 = 非车跟单金额
- insPlyIncome.setNoOtherCostsPremium(syother);
- }
- /**
- 判断是否是平台 如果是平台则 手续费= 交强手续费+ 商业手续费+非车手续费 费单非= 交强跟单费+ 商业跟单费 +非车跟单费费
- * 如果是保险 保险手续费= 交强手续费+商业跟单费 跟单费为null
- * 保险跟单 手续费为null 跟单费= 交强跟单费+商业跟单费
- * 非车手续费 =非车手续费
- * 非车跟单 = 非车跟单费
- */
- if("1".equals(insPlyIncomeVo.getAgreementType())){//保险手续费
- insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(),insPlyIncome.getSySuperviseCostsProportion(),insPlyIncome.getNoSuperviseCostsProportion())); //手续费比例
- insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),insPlyIncome.getSySuperviseCostsPremiums(),insPlyIncome.getNoSuperviseCostsPremiums())); //手续费金额
- insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),insPlyIncome.getSyOtherCostsProportion(),insPlyIncome.getNoOtherCostsProportion())); //跟单比例
- insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),insPlyIncome.getSyOtherCostsPremium(),insPlyIncome.getNoOtherCostsPremium()));//跟单费金额
- insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),insPlyIncome.getOtherFeevalue(),null)); // 总费用 = 手续费+跟单费
- }else {
- 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.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),null,null));//总金额
- }else { //保险跟单费 交强跟单+商业跟单
- 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)); // 非车手续费
- insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getNoSuperviseCostsProportion(),null,null)); //非车比例
- insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),null,null));//总金额
- }else { //非车跟单
- insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getNoOtherCostsPremium(),null,null)); //非车跟单金额
- insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getNoOtherCostsProportion(),null,null)); // 非车跟单比例
- insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getOtherFeevalue(),null,null));//总金额
- }
- }
- }
- private void saveLog(InsPlyIncomeVo insPlyIncomeVo) {
- // 添加记录
- SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
- settlementDocumentaryLogEntity.setCrudStatus(insPlyIncomeVo.getCrudStatus());
- settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue());
- settlementDocumentaryLogEntity.setSettlementDocumentaryId(insPlyIncomeVo.getId());
- settlementDocumentaryLogEntity.setAmountType("2");
- settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
- }
- @Override
- @Transactional
- public HttpResult<InsPlyIncome> insertByEntity(InsPlyIncomeVo insPlyIncomeVo) {
- Long id = new SnowFlakeUtil().nextId();
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- insPlyIncomeVo.setOrderno(id.toString());
- BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
- insPlyIncome.setDocumentaryFeesStatus("0");
- insPlyIncome.setHandlingFeesStatus("0");
- insPlyIncome.setIsNotCar("0");
- insPlyIncome.setIsNotDocumentary("1");
- baseMapper.insert(insPlyIncome);
- insPlyIncomeVo.setId(insPlyIncome.getId());
- insPlyIncomeVo.setCrudStatus("1");
- this.saveLog(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());
- }
- List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
- if(!CollectionUtils.isEmpty(list)){
- for (InsPlyIncome item :list){
- return HttpResult.ok(item.getIds());
- }
- }
- return null;
- }
- @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());
- }
- } else {
- return HttpResult.ok(null);
- }
- return HttpResult.ok("删除成功");
- }
- @Override
- @Transactional
- public void uodateBalance(InsPlyIncomeVo insPlyIncomeVo) {
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- insPlyIncomeVo.setHandlingFeesStatus("1");
- insPlyIncomeVo.setSettlementTime(LocalDate.now());
- BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
- baseMapper.updateById(insPlyIncome);
- // 生成记录
- SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getAgreementType()) && "1".equals(insPlyIncomeVo.getAgreementType())){
- // 只有平台协议 才会跟单费一笔结算
- settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue()); // 跟单费金额
- }
- settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getCommissionFeevalue()); // 手续费金额
- settlementDocumentaryLogEntity.setSettlementDocumentaryId(insPlyIncomeVo.getId()); // 关联id
- settlementDocumentaryLogEntity.setAmountType("1"); //手续费结算
- settlementDocumentaryLogEntity.setCreateTime(new Date());
- settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
- }
- @Override
- @Transactional
- public HttpResult<BasePageResult<InsPlyIncome>> totalQuery(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- PageInfo<List<InsPlyIncome>> pageHelper = null;
- if(insPlyIncomeVo.getStartDate()!=null){
- params.put("startDate",insPlyIncomeVo.getStartDate().toString());
- }
- if(insPlyIncomeVo.getEndDate()!=null){
- params.put("endDate",insPlyIncomeVo.getEndDate().toString());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
- params.put("year",insPlyIncomeVo.getYear());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
- params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
- params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getDocumentaryFeesStatus())){
- params.put("documentaryFeesStatus",insPlyIncomeVo.getDocumentaryFeesStatus());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
- params.put("companyId",insPlyIncomeVo.getCompanyId());
- }
- params.put("pageNum",insPlyIncomeVo.getPageNum());
- params.put("pageSize",insPlyIncomeVo.getPageSize());
- List<InsPlyIncome> list= this.baseMapper.totalQuery(params);
- pageHelper=new PageInfo(list);
- return HttpResult.ok(new BasePageResult<>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list));
- }
- @Override
- @Transactional
- public HttpResult batchBalance(InsPlyIncomeVo insPlyIncomeVo) {
- // 通过ids 查出跟单非结算单
- String ids = insPlyIncomeVo.getIds();
- if(StringUtils.isNotEmpty(ids)){
- String[] split = ids.split(",");
- for (int i =0; i <split.length ; i++) {
- String id = split[i];
- InsPlyIncome insPlyIncome = baseMapper.selectById(id);
- insPlyIncome.setDocumentaryFeesStatus("1"); //1 为跟单费已经结算
- insPlyIncome.setSettlementTime(LocalDate.now());
- baseMapper.updateById(insPlyIncome);
- }
- }
- SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo(); // 生成跟单费结算表
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
- settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
- }
- settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
- settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue()); //其他费用金额
- settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getOtherFeevalue().subtract(insPlyIncomeVo.getInvoicCommissionFeevalue())); //未开票金额
- settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());//已开票金额
- settlementDocumentaryFeesVo.setSettlementStatus("2");
- settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
- settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
- settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
- return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
- }
- @Override
- public List<InsPlyIncome> totalBxAmount(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- params=this.saveParams(insPlyIncomeVo,params);
- params.remove("handlingFeesStatus");
- List<InsPlyIncome> resultList = baseMapper.totalBxAmount(params);
- return resultList;
- }
- @Override
- @Transactional
- public HttpResult<Object> batchInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
- // 开票时生成 记录 用来合计已经开票数据
- String ids = insPlyIncomeVo.getIds();
- if(StringUtils.isNotEmpty(ids)){
- String[] split = ids.split(",");
- for (String id : split){
- InsPlyIncome insPlyIncome = baseMapper.selectById(id);
- insPlyIncome.setInvoicTime(LocalDate.now()); //开票时间
- insPlyIncome.setInvoicId(insPlyIncomeVo.getInvoicId()); //开票号
- insPlyIncome.setHandlingFeesStatus("2"); //2为开票
- baseMapper.updateById(insPlyIncome);
- }
- }
- return HttpResult.ok();
- }
- @Override
- public HttpResult<InsPlyIncome> queryInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- params = this.saveParams(insPlyIncomeVo, params);
- InsPlyIncome result= baseMapper.queryInvoicing(params); //总金额
- params.put("handlingFeesStatus","0");
- InsPlyIncome noResult= baseMapper.queryInvoicing(params); //未结算金额
- result.setReadyCommissionFeevalue(noResult.getCommissionFeevalue());
- return HttpResult.ok(result);
- }
- @Override
- public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
- InsPlyIncome insPlyIncome = new InsPlyIncome();
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){
- String[] split = insPlyIncomeVo.getIds().split(",");
- for(String id : split){
- insPlyIncome.setId(id);
- insPlyIncome.setHandlingFeesStatus("1");
- insPlyIncome.setSettlementTime(LocalDate.now());
- baseMapper.updateById(insPlyIncome);
- }
- }
- SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
- settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getReadyCommissionFeevalue());
- settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
- settlementDocumentaryLogEntity.setCreateTime(new Date());
- settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
- settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
- return HttpResult.ok();
- }
- @Override
- public HttpResult<InsPlyIncome> querySettInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- params = this.saveParams(insPlyIncomeVo, params);
- InsPlyIncome insPlyIncome = baseMapper.queryInvoicing(params); //已经开票
- return HttpResult.ok(insPlyIncome);
- }
- @Override
- public HttpResult<List<InsPlyIncome>> allOtherAmount(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- params=this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> result= baseMapper.allOtherAmount(params);
- return HttpResult.ok(result);
- }
- @Override
- @Transactional
- public HttpResult<Object> batchInvoic(InsPlyIncomeVo insPlyIncomeVo) {
- // 通过ids 查出跟单非结算单
- String ids = insPlyIncomeVo.getIds();
- if(StringUtils.isNotEmpty(ids)){
- String[] split = ids.split(",");
- for (int i =0; i <split.length ; i++) {
- String id = split[i];
- InsPlyIncome insPlyIncome = baseMapper.selectById(id);
- insPlyIncome.setInvoicId(insPlyIncomeVo.getContractId()); // 开票号
- insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
- insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
- insPlyIncome.setSettlementTime(LocalDate.now());
- baseMapper.updateById(insPlyIncome);
- }
- }
- SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo(); // 生成跟单费结算表
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
- settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
- settlementDocumentaryFeesVo.setYear(insPlyIncomeVo.getYear());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())){
- settlementDocumentaryFeesVo.setMonth(insPlyIncomeVo.getMonth());
- }
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getDay())){
- settlementDocumentaryFeesVo.setDay(insPlyIncomeVo.getDay());
- }
- settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
- settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue()); //其他费用金额
- settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
- settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
- settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
- settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
- settlementDocumentaryFeesVo.setSettlementStatus("1");
- settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
- settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());
- return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
- }
- @Override
- public HttpResult pinHandlingexcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
- HashMap<String, Object> params = new HashMap<>();
- params =this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
- ExportParams exportParams = new ExportParams("平台手续费", null, ExcelType.HSSF);
- exportParams.setStyle(ExcelStyleUtil.class);
- List<SettlementFeesExcel> resultList = new ArrayList<>();
- for (InsPlyIncome item :insPlyIncomes){
- SettlementFeesExcel bxSettlementFeesExcel = new SettlementFeesExcel();
- BeanUtils.copyProperties(item, bxSettlementFeesExcel);
- resultList.add(bxSettlementFeesExcel);
- }
- String uploadPath = this.uploadPath + "/excel/";
- Path path = Paths.get(uploadPath);
- if (!Files.exists(path)) {
- try {
- Files.createDirectories(path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- String fileName = EasyExcelUtils.downExcel(uploadPath, "平台手续费导出", SettlementFeesExcel.class, resultList);
- return HttpResult.ok("",uploadUrl + "excel/" + fileName);
- }
- @Override
- public HttpResult bxHandlingexcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
- HashMap<String, Object> params = new HashMap<>();
- params =this.saveParams(insPlyIncomeVo,params);
- List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
- ExportParams exportParams = new ExportParams("保险手续费", null, ExcelType.HSSF);
- exportParams.setStyle(ExcelStyleUtil.class);
- List<BxSettlementFeesExcel> resultList = new ArrayList<>();
- for (InsPlyIncome item :insPlyIncomes){
- BxSettlementFeesExcel bxSettlementFeesExcel = new BxSettlementFeesExcel();
- LocalDateTime signDate = item.getSignDate();
- BeanUtils.copyProperties(item, bxSettlementFeesExcel);
- resultList.add(bxSettlementFeesExcel);
- }
- String uploadPath = this.uploadPath + "/excel/";
- Path path = Paths.get(uploadPath);
- if (!Files.exists(path)) {
- try {
- Files.createDirectories(path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- String fileName = EasyExcelUtils.downExcel(uploadPath, "保险手续费导出", BxSettlementFeesExcel.class, resultList);
- return HttpResult.ok("",uploadUrl + "excel/" + fileName);
- }
- @Override
- public HttpResult bxOtherExcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
- HashMap<String, Object> params = new HashMap<>();
- params =this.saveParams(insPlyIncomeVo,params);
- params.put("agreementType","2");
- params.put("isOther","1");
- params.put("isNotCar","0");
- List<InsPlyIncome> insPlyIncomes = baseMapper.allOtherAmount(params);
- ExportParams exportParams = new ExportParams("跟单费导出", null, ExcelType.HSSF);
- exportParams.setStyle(ExcelStyleUtil.class);
- List<BxOtherExcel> resultList = new ArrayList<>();
- for (InsPlyIncome item :insPlyIncomes){
- BxOtherExcel bxSettlementFeesExcel = new BxOtherExcel();
- BeanUtils.copyProperties(item, bxSettlementFeesExcel);
- resultList.add(bxSettlementFeesExcel);
- }
- String uploadPath = this.uploadPath + "/excel/";
- Path path = Paths.get(uploadPath);
- if (!Files.exists(path)) {
- try {
- Files.createDirectories(path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- String fileName = EasyExcelUtils.downExcel(uploadPath, "跟单费导出", BxOtherExcel.class, resultList);
- return HttpResult.ok("",uploadUrl + "excel/" + fileName);
- }
- @Override
- public InsPlyIncome bxTotalAmount(InsPlyIncomeVo insPlyIncomeVo) {
- HashMap<String, Object> params = new HashMap<>();
- params = this.saveParams(insPlyIncomeVo, params);
- InsPlyIncome totalledAmount =baseMapper.bxTotalAmount(params); //总金额
- return totalledAmount;
- }
- }
|