| | |
| | | @Autowired |
| | | private SolutionsMapper solutionsMapper; |
| | | |
| | | @Autowired |
| | | private NoticesMapper noticesMapper; |
| | | /** |
| | | * 平台退回投保 |
| | | * @param param |
| | |
| | | ApplyChange update = new ApplyChange(); |
| | | update.setEditDate(new Date()); |
| | | update.setEditor(user.getId()); |
| | | update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()); |
| | | update.setStatus(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey()); |
| | | update.setCheckDate(update.getEditDate()); |
| | | update.setCheckInfo(param.getCheckInfo()); |
| | | update.setCheckUserId(user.getId()); |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | |
| | | InsuranceApply insuranceApply = insuranceApplyMapper.selectById(model.getApplyId()); |
| | | if(Objects.isNull(insuranceApply)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(insuranceApply.getIsdeleted().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"数据已删除,无法进行该操作"); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未查询到方案信息"); |
| | | } |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Constants.ApplyLogType applyLogType = null; |
| | | String info = ""; |
| | | ApplyChange update = new ApplyChange(); |
| | | Constants.NoticeType noticeType = Constants.NoticeType.FOUR; |
| | | if(param.getDealBackApply() ==1){ |
| | | //如果是驳回,只能可驳回已签章状态下的退回申请状态进行操作 |
| | | if(!Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){ |
| | |
| | | info = applyLogType.getInfo(); |
| | | info = info.replace("${param}", param.getCheckInfo()); |
| | | update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey()); |
| | | noticeType = Constants.NoticeType.FIVE; |
| | | }else{ |
| | | //如果是同意,两种申请退回状态都可操作 |
| | | if(!(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()) |
| | | ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~"); |
| | | } |
| | | applyLogType = Constants.ApplyLogType.CA_PALTFORM_REFUSE_APPLY; |
| | | if( Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){ |
| | | update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey()); |
| | | }else if( Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())){ |
| | | update.setStatus(Constants.ApplyChangeStatus.UPLOAD.getKey()); |
| | | } |
| | | update.setStatus(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey()); |
| | | applyLogType = Constants.ApplyLogType.CA_PLATFORM_AGREE_BACK_APPLY; |
| | | } |
| | | |
| | | update.setEditDate(new Date()); |
| | | update.setEditor(user.getId()); |
| | | //同意退回,直接回到最初状态,如果驳回退回申请,则保单状态回到待上传保险单 |
| | |
| | | update.setCheckUserId(user.getId()); |
| | | update.setId(model.getId()); |
| | | applyChangeMapper.updateById(update); |
| | | |
| | | |
| | | //存储待办信息 |
| | | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE; |
| | | if(model.getType().equals(Constants.ONE)){ |
| | | noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY; |
| | | } |
| | | //删除其他待办 |
| | | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId())); |
| | | Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),solutions.getName(), |
| | | model.getCompanyId(), noticeType); |
| | | noticesMapper.insert(notices); |
| | | |
| | | ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); |
| | | applyLogMapper.insert(log); |
| | |
| | | if (!loginUserInfo.getType().equals(Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "用户类型错误:非企业用户无法进行该操作"); |
| | | } |
| | | BigDecimal fee = BigDecimal.ZERO; |
| | | |
| | | InsuranceApply insuranceApply = insuranceApplyMapper.selectById(applyChange.getApplyId()); |
| | | if (Objects.isNull(insuranceApply)) { |
| | |
| | | applyChange.setStatus(Constants.ZERO); |
| | | applyChangeMapper.insert(applyChange); |
| | | |
| | | this.dealApplyChangeData(applyChange,insuranceApply,companySolution,solutions,loginUserInfo,fee); |
| | | BigDecimal fee = this.dealApplyChangeData(applyChange,insuranceApply,companySolution,solutions,loginUserInfo,BigDecimal.ZERO); |
| | | |
| | | ApplyChange applyChangeFee = new ApplyChange(); |
| | | applyChangeFee.setId(applyChange.getId()); |
| | | applyChangeFee.setFee(fee); |
| | | applyChangeMapper.updateById(applyChangeFee); |
| | | |
| | | |
| | | this.saveApplyLog(applyChange,Constants.ApplyChangeLogStatus.UPLOAD,null); |
| | | return applyChange.getId(); |
| | |
| | | if(Objects.isNull(dbApplyChange)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!dbApplyChange.getStatus().equals(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey())){ |
| | | if(! (dbApplyChange.getStatus().equals(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey()) |
| | | || dbApplyChange.getStatus().equals(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey()) ) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(), "业务保申请单状态错误"); |
| | | } |
| | | |
| | |
| | | |
| | | applyChange.setEditDate(new Date()); |
| | | applyChange.setEditor(loginUserInfo.getId()); |
| | | applyChange.setApplyStartTime(applyChange.getValidTime()); |
| | | applyChange.setStatus(Constants.ZERO); |
| | | BigDecimal fee = BigDecimal.ZERO; |
| | | //删除历史数据 |
| | | applyChagneDetailJoinMapper.delete(new QueryWrapper<ApplyChagneDetail>().lambda().eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId())); |
| | | |
| | | this.dealApplyChangeData(applyChange,insuranceApply,companySolution,solutions,loginUserInfo,fee); |
| | | BigDecimal fee = this.dealApplyChangeData(applyChange,insuranceApply,companySolution,solutions,loginUserInfo,BigDecimal.ZERO); |
| | | applyChange.setFee(fee); |
| | | applyChangeMapper.updateById(applyChange); |
| | | this.saveApplyLog(applyChange,Constants.ApplyChangeLogStatus.UPLOAD,null); |
| | |
| | | } |
| | | |
| | | |
| | | public void dealApplyChangeData(ApplyChange applyChange,InsuranceApply insuranceApply,CompanySolution companySolution,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal fee){ |
| | | public BigDecimal dealApplyChangeData(ApplyChange applyChange,InsuranceApply insuranceApply,CompanySolution companySolution,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal fee){ |
| | | |
| | | |
| | | //查询保险方案下的所有派遣单位 |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行加保"); |
| | | } |
| | | //加保明细数据 计算金额 根据批单时间 计算 |
| | | applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(insuranceApply.getStartTime(),1)); |
| | | applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),1)); |
| | | CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); |
| | | BigDecimal detailFee = countCyclePriceVO.getCyclePrice(); |
| | | |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行减保"); |
| | | } |
| | | //减保明细数据 计算金额 根据批单时间 前一天 计算 |
| | | applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(insuranceApply.getStartTime(),3)); |
| | | applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),3)); |
| | | CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); |
| | | BigDecimal detailFee = countCyclePriceVO.getCyclePrice(); |
| | | this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee); |
| | |
| | | if (CollectionUtils.isNotEmpty(changeDetailList)) { |
| | | this.changeDetail(applyChange,changeDetailList,duWorktypeList,duSolutionList,loginUserInfo); |
| | | } |
| | | return fee; |
| | | } |
| | | |
| | | |
| | |
| | | if (applyChagneDetailJoinMapper.selectJoinCount( |
| | | new MPJLambdaWrapper<ApplyChagneDetail>() |
| | | .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) |
| | | .eq(ApplyChange::getApplyId,applyChange.getApplyId()) |
| | | .eq(ApplyChagneDetail::getMemberId, applyChagneDetail.getMemberId()) |
| | | .in(ApplyChange::getStatus, Constants.ZERO, Constants.ONE) |
| | | ) > Constants.ZERO) { |
| | |
| | | applyChagneDetail.setType(Constants.ONE); |
| | | |
| | | applyChagneDetail.setStartTime(DateUtil.getMontageDate(applyDetail.getStartTime(),1)); |
| | | applyChagneDetail.setEndTime(DateUtil.getMontageDate(applyChange.getStartTime(),3)); |
| | | applyChagneDetail.setEndTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),3)); |
| | | |
| | | applyChagneDetail.setFee( detailFee.multiply(new BigDecimal(-1))); |
| | | applyChagneDetailJoinMapper.insert(applyChagneDetail); |
| | |
| | | new MPJLambdaWrapper<ApplyChagneDetail>() |
| | | .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) |
| | | .eq(ApplyChagneDetail::getMemberId, applyChagneDetail.getMemberId()) |
| | | .eq(ApplyChange::getApplyId,applyChange.getApplyId()) |
| | | .in(ApplyChange::getStatus, Constants.ZERO, Constants.ONE) |
| | | ) > Constants.ZERO) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "加保人员【" + applyChagneDetail.getMemberName() + "】存在申请中的加减保/换厂单据"); |
| | |
| | | List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda() |
| | | .eq(ApplyDetail::getApplyId, applyChange.getApplyId()) |
| | | .eq(ApplyDetail::getMemberId, applyChagneDetail.getMemberId()) |
| | | .le(ApplyDetail::getStartTime, DateUtil.getDate(new Date(),"yyyy-MM-dd HH:mm:ss")) |
| | | .ge(ApplyDetail::getEndTime, DateUtil.getDate(new Date(),"yyyy-MM-dd HH:mm:ss"))); |
| | | .ge(ApplyDetail::getEndTime, new Date())); |
| | | if(applyDetailList.size()>Constants.ONE){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "换厂人员【" + applyChagneDetail.getMemberName() + "】保单信息异常,存在多条数据"); |
| | | }else if(applyDetailList.size()==Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "换厂人员【" + applyChagneDetail.getMemberName() + "】未查询到投保记录"); |
| | | } |
| | | ApplyDetail applyDetail = applyDetailList.get(Constants.ZERO); |
| | | if(applyChange.getValidTime().compareTo( applyDetail.getEndTime())>0){ |
| | |
| | | .in(!Objects.isNull(model.getStatus())&&model.getStatus().equals(Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()),ApplyChange::getStatus, |
| | | Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey(), |
| | | Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()) |
| | | .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) |
| | | // .eq(!Objects.isNull(model.getCompanyId()),InsuranceApply::getCompanyId,model.getCompanyId()) |
| | | // .eq(!Objects.isNull(model.getSolutionsId()),ApplyChange::getSolutionsId,model.getSolutionsId()) |
| | | .eq(!Objects.isNull(model.getBaseSolutionsId()),Solutions::getBaseId,model.getBaseSolutionsId()) |
| | | .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" ) |
| | | .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" ); |
| | | |
| | | LoginUserInfo loginUserInfo =(LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | //企业人员查看本企业数据 |
| | | if(loginUserInfo.getType().equals(Constants.ONE)){ |
| | | queryWrapper.eq(InsuranceApply::getCompanyId, loginUserInfo.getCompanyId()); |
| | | }else{ |
| | | if(loginUserInfo.getCompanyIdList()!=null && loginUserInfo.getCompanyIdList().size()>0){ |
| | | queryWrapper.in(InsuranceApply::getCompanyId, loginUserInfo.getCompanyIdList()); |
| | | }else{ |
| | | queryWrapper.eq(InsuranceApply::getCompanyId, -1); |
| | | } |
| | | queryWrapper.eq(pageWrap.getModel().getCompanyId()!=null,InsuranceApply::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | |
| | | public void changeOpt(ApplyChangeOptDTO applyChangeOptDTO){ |
| | | if(Objects.isNull(applyChangeOptDTO) |
| | | ||Objects.isNull(applyChangeOptDTO.getApplyId()) |
| | | ||StringUtils.isBlank(applyChangeOptDTO.getOptIllustration())){ |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | |
| | | if(applyChange.getIsdeleted().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"数据已删除,无法进行该操作"); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询方案信息"); |
| | | } |
| | | |
| | | Constants.ApplyChangeLogStatus applyChangeLogStatus = Constants.ApplyChangeLogStatus.RETURN_APPLY; |
| | | |
| | | Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.APPLY_CHANGE; |
| | | if(applyChange.getType().equals(Constants.ONE)){ |
| | | noticeObjectType = Constants.NoticeObjectType.CHANGE_FACTORY; |
| | | } |
| | | if(applyChangeOptDTO.getOptType().equals(3)){ |
| | | //发起退回申请 |
| | | if(loginUserInfo.getType().equals(Constants.ONE)){ |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业端用户无法进行该操作"); |
| | | } |
| | | if(!(applyChange.getStatus().equals(Constants.ApplyChangeStatus.UPLOAD.getKey()) |
| | |
| | | }else{ |
| | | applyChange.setStatus(Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey()); |
| | | } |
| | | |
| | | //存储待办信息 |
| | | //删除其他待办 |
| | | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,applyChange.getId())); |
| | | Notices notices = new Notices(noticeObjectType,Constants.ZERO,applyChange.getId(),solutions.getName(), |
| | | applyChange.getCompanyId(), Constants.NoticeType.THREE); |
| | | noticesMapper.insert(notices); |
| | | |
| | | |
| | | }else if(applyChangeOptDTO.getOptType().equals(4)){ |
| | | applyChangeLogStatus = Constants.ApplyChangeLogStatus.PLATFORM_AGREE; |
| | |
| | | }else if(applyChangeOptDTO.getOptType().equals(6)){ |
| | | //企业关闭 |
| | | applyChangeLogStatus = Constants.ApplyChangeLogStatus.CLOSE; |
| | | if(loginUserInfo.getType().equals(Constants.ONE)){ |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业端用户无法进行该操作"); |
| | | } |
| | | if(!applyChange.getStatus().equals(Constants.ApplyChangeStatus.PLATFORM_AGREE.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"数据状态错误无法进行该操作!"); |
| | | } |
| | | applyChange.setStatus(Constants.ApplyChangeStatus.CLOSE.getKey()); |
| | | |
| | | |
| | | //存储待办信息 |
| | | //删除其他待办 |
| | | noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,applyChange.getId())); |
| | | |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST ); |
| | | } |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Company company = user.getCompany(); |
| | | if(debugModel){ |
| | | company = companyMapper.selectById(model.getCompanyId()); |
| | | company = companyMapper.selectById(model.getCompanyId()); |
| | | } |
| | | if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业尚未具备在线签章条件,请联系平台管理员确认~"); |
| | | } |
| | | InsuranceApply insuranceApply = insuranceApplyMapper.selectById(model.getApplyId()); |
| | | if(Objects.isNull(insuranceApply)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询保单信息"); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询方案信息"); |
| | | } |
| | | String fileUrl = null; |
| | | if(Constants.equalsObject(model.getType(), Constants.ONE)){ |
| | |
| | | update.setSignApplyNo(applyNo); |
| | | applyChangeMapper.updateById(update); |
| | | |
| | | |
| | | |
| | | return link; |
| | | } |
| | | |