| | |
| | | import com.ruoyi.system.pojo.dto.OrderPageDTO; |
| | | import com.ruoyi.system.pojo.model.DailyStatistics; |
| | | import com.ruoyi.system.pojo.vo.*; |
| | | import com.ruoyi.system.service.CompanyTypeService; |
| | | import com.ruoyi.system.service.OrderService; |
| | | import com.ruoyi.system.wx.RefundCallbackResult; |
| | | import com.ruoyi.system.wx.WechatPayService; |
| | |
| | | private RedisCache redisCache; |
| | | @Resource |
| | | private QichachaMapper qichachaMapper; |
| | | |
| | | @Resource |
| | | private CompanyTypeService companyTypeService; |
| | | |
| | | |
| | | @Resource |
| | | private AccountDetailMapper accountDetailMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | throw new ServiceException("公司不存在"); |
| | | } |
| | | BusinessVO vo = new BusinessVO(); |
| | | // 先查企业工商信息 更新数据 |
| | | JSONObject jsonObject = getQiChaChaBasicDetailsCompany(company.getCompanyName()); |
| | | company.setOperName(jsonObject.getString("OperName")); |
| | | company.setBelongOrg(jsonObject.getString("BelongOrg")); |
| | | company.setRegistrationStatus(jsonObject.getString("Status")); |
| | | company.setRegisteredCapital(jsonObject.getString("RegisteredCapital")); |
| | | company.setPaidInFunds(jsonObject.getString("PaidUpCapital")); |
| | | companyMapper.updateById(company); |
| | | BeanUtils.copyProperties(company, vo); |
| | | vo.setNewRegisteredCapital(company.getRealRegisteredCapital()); |
| | | vo.setPlace(company.getCity()+company.getProvince()+company.getArea()); |
| | | |
| | | //todo 再查企业工商信息 覆盖掉之前的 |
| | | JSONObject area = jsonObject.getJSONObject("Area"); |
| | | if (null != area) { |
| | | vo.setPlace(area.getString("Province")+"-"+area.getString("City")+"-"+area.getString("County")); |
| | | }else { |
| | | vo.setPlace(company.getCity() + "-" + company.getProvince() + "-" + company.getArea()); |
| | | } |
| | | |
| | | vo.setCompanyCategoryName(jsonObject.getString("EconKind")); |
| | | |
| | | String name = companyTypeService.getById(company.getCompanyCategory()).getName(); |
| | | vo.setCompanyCategoryName(name); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 经营异常核查 |
| | | * @param companyName |
| | | * @return |
| | | * VerifyResult int 数据是否存在(1-存在,0-不存在) |
| | | * Data List<Object> 数据信息 |
| | | * Data:[{ |
| | | * AddReason 列入经营异常名录原因 |
| | | * AddDate 列入日期 |
| | | * RomoveReason 移出经营异常名录原因(保留字段) |
| | | * RemoveDate 移出日期(保留字段) |
| | | * DecisionOffice 作出决定机关 |
| | | * RemoveDecisionOffice 移出决定机关(保留字段) |
| | | * }] |
| | | * Status |
| | | * Message |
| | | * OrderNumber |
| | | * 查询工商信息 |
| | | */ |
| | | public JSONObject getQiChaChaBasicDetailsCompany(String companyName){ |
| | | Object cacheObject = redisCache.getCacheObject("qichacha_" +"basic_"+ companyName); |
| | |
| | | public R change(String id) { |
| | | // System.err.println(getReport("ZZD20250508017232394218445")); |
| | | ChangeVO changeVO = new ChangeVO(); |
| | | /* Company companyInfo = companyMapper.selectById(id); |
| | | Company companyInfo = companyMapper.selectById(id); |
| | | if (null == companyInfo || companyInfo.getIsDelete() != 0) { |
| | | throw new ServiceException("公司不存在"); |
| | | }*/ |
| | | // JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]); |
| | | JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | } |
| | | JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]); |
| | | // JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | if (!"1001".equals(jsonObject.getString("code"))){ |
| | | return R.fail(jsonObject.get("msg")); |
| | | } |
| | |
| | | @Override |
| | | public R tax(String id) { |
| | | TaxVO taxVO = new TaxVO(); |
| | | /* Company companyInfo = companyMapper.selectById(id); |
| | | Company companyInfo = companyMapper.selectById(id); |
| | | if (null == companyInfo || companyInfo.getIsDelete() != 0) { |
| | | throw new ServiceException("公司不存在"); |
| | | }*/ |
| | | // JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]); |
| | | JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | } |
| | | JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]); |
| | | // JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | if (!"1001".equals(jsonObject.getString("code"))){ |
| | | return R.fail(jsonObject.get("msg")); |
| | | } |
| | |
| | | JSONObject data2 = (JSONObject) data1.get("data"); |
| | | JSONObject taxInfo = (JSONObject) data2.get("taxInfo"); |
| | | //税务处罚 |
| | | JSONObject enterprise = (JSONObject) data2.get("enterprise"); |
| | | JSONArray enterprise = data2.getJSONArray("enterprise"); |
| | | taxVO.setEnterprise(enterprise); |
| | | //滞纳金情况 |
| | | JSONArray overdueFineDetailsList = (JSONArray) taxInfo.get("overdueFineDetailsList"); |
| | |
| | | taxVO.setTaxpayerType(taxpayerType); |
| | | |
| | | //近12月增税销售额 |
| | | JSONObject taxPrevMnMthsAllTaxDclrPrjInfoDict = (JSONObject) taxInfo.get("taxPrevMnMthsAllTaxDclrPrjInfoDict"); |
| | | JSONObject taxPrevMnMthsAllTaxDclrPrjInfoDict = taxInfo.getJSONObject("taxPrevMnMthsAllTaxDclrPrjInfoDict"); |
| | | if (null != taxPrevMnMthsAllTaxDclrPrjInfoDict){ |
| | | JSONObject taxPrev12mthsAllTaxDclrPrjInfoDict = taxPrevMnMthsAllTaxDclrPrjInfoDict.getJSONObject("taxPrev12mthsAllTaxDclrPrjInfoDict"); |
| | | if (null != taxPrev12mthsAllTaxDclrPrjInfoDict){ |
| | | // 使用 getBigDecimal 方法,自动处理类型转换 |
| | | BigDecimal vatTaxValue = taxPrev12mthsAllTaxDclrPrjInfoDict.getBigDecimal("vatTaxShouldsaleAmt"); |
| | | taxVO.setVatTaxShouldsaleAmt12(vatTaxValue); // 自动处理 null |
| | | } |
| | | //近24月增税销售额 |
| | | JSONObject taxPrev24mthsAllTaxDclrPrjInfoDict = taxPrevMnMthsAllTaxDclrPrjInfoDict.getJSONObject("taxPrev24mthsAllTaxDclrPrjInfoDict"); |
| | | if(null != taxPrev24mthsAllTaxDclrPrjInfoDict){ |
| | | taxVO.setVatTaxShouldsaleAmt24( (BigDecimal) taxPrev24mthsAllTaxDclrPrjInfoDict.get("vatTaxShouldsaleAmt")); |
| | | } |
| | | //近12月增税应纳额(元) |
| | | taxVO.setVatTaxShouldpay(taxPrev12mthsAllTaxDclrPrjInfoDict.getBigDecimal("vatTaxShouldpay")); |
| | | } |
| | | |
| | | JSONObject taxPrev12mthsAllTaxDclrPrjInfoDict = (JSONObject) taxPrevMnMthsAllTaxDclrPrjInfoDict.get("taxPrev12mthsAllTaxDclrPrjInfoDict"); |
| | | taxVO.setVatTaxShouldsaleAmt12((BigDecimal) taxPrev12mthsAllTaxDclrPrjInfoDict.get("vatTaxShouldsaleAmt")); |
| | | //近24月增税销售额 |
| | | JSONObject taxPrev24mthsAllTaxDclrPrjInfoDict = (JSONObject) taxPrevMnMthsAllTaxDclrPrjInfoDict.get("taxPrev24mthsAllTaxDclrPrjInfoDict"); |
| | | |
| | | taxVO.setVatTaxShouldsaleAmt24( (BigDecimal) taxPrev24mthsAllTaxDclrPrjInfoDict.get("vatTaxShouldsaleAmt")); |
| | | JSONObject taxPrevMnMthsTaxInfoDict = (JSONObject) taxInfo.get("taxPrevMnMthsTaxInfoDict"); |
| | | |
| | | //近12月纳税总额(元) |
| | | JSONObject taxPrev12mthsTaxInfo = (JSONObject) taxPrevMnMthsTaxInfoDict.get("taxPrev12mthsTaxInfo"); |
| | | taxVO.setTaxAmt12( (BigDecimal) taxPrev12mthsTaxInfo.get("taxAmt")); |
| | | JSONObject taxPrevMnMthsTaxInfoDict = taxInfo.getJSONObject("taxPrevMnMthsTaxInfoDict"); |
| | | if (null!=taxPrevMnMthsTaxInfoDict){ |
| | | //近12月纳税总额(元) |
| | | JSONObject taxPrev12mthsTaxInfo = taxPrevMnMthsTaxInfoDict.getJSONObject("taxPrev12mthsTaxInfo"); |
| | | taxVO.setTaxAmt12( (BigDecimal) taxPrev12mthsTaxInfo.get("taxAmt")); |
| | | |
| | | //近24月纳税总额(元) |
| | | JSONObject taxPrev24mthsTaxInfo = (JSONObject) taxPrevMnMthsTaxInfoDict.get("taxPrev24mthsTaxInfo"); |
| | | taxVO.setTaxAmt24( (BigDecimal) taxPrev24mthsTaxInfo.get("taxAmt")); |
| | | //近24月纳税总额(元) |
| | | JSONObject taxPrev24mthsTaxInfo = taxPrevMnMthsTaxInfoDict.getJSONObject("taxPrev24mthsTaxInfo"); |
| | | if (null != taxPrev24mthsTaxInfo){ |
| | | taxVO.setTaxAmt24( (BigDecimal) taxPrev24mthsTaxInfo.get("taxAmt")); |
| | | |
| | | //近12月增税应纳额(元) |
| | | taxVO.setVatTaxShouldpay( (BigDecimal) taxPrev12mthsAllTaxDclrPrjInfoDict.get("vatTaxShouldpay")); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //近12个月滞纳金金额(元) 次数 |
| | | JSONObject taxPrevMnMthsOverdueFineInfoDict = (JSONObject) taxInfo.get("taxPrevMnMthsOverdueFineInfoDict"); |
| | | JSONObject taxPrev12mthsOverdueFineInfo = (JSONObject) taxPrevMnMthsOverdueFineInfoDict.get("taxPrev12mthsOverdueFineInfo"); |
| | | taxVO.setOverdueFineInfoAmt12( (BigDecimal) taxPrev12mthsOverdueFineInfo.get("overdueFineInfoAmt")); |
| | | taxVO.setOverdueFineInfoCnt12( (Integer) taxPrev12mthsOverdueFineInfo.get("overdueFineInfoCnt")); |
| | | JSONObject taxPrevMnMthsOverdueFineInfoDict = taxInfo.getJSONObject("taxPrevMnMthsOverdueFineInfoDict"); |
| | | if (null != taxPrevMnMthsOverdueFineInfoDict){ |
| | | JSONObject taxPrev12mthsOverdueFineInfo = taxPrevMnMthsOverdueFineInfoDict.getJSONObject("taxPrev12mthsOverdueFineInfo"); |
| | | if (null!= taxPrev12mthsOverdueFineInfo){ |
| | | taxVO.setOverdueFineInfoAmt12( (BigDecimal) taxPrev12mthsOverdueFineInfo.get("overdueFineInfoAmt")); |
| | | taxVO.setOverdueFineInfoCnt12( (Integer) taxPrev12mthsOverdueFineInfo.get("overdueFineInfoCnt")); |
| | | } |
| | | // 近3个月滞纳金金额(元) |
| | | JSONObject taxPrev3mthsOverdueFineInfo = taxPrevMnMthsOverdueFineInfoDict.getJSONObject("taxPrev3mthsOverdueFineInfo"); |
| | | if (null != taxPrev3mthsOverdueFineInfo){ |
| | | taxVO.setOverdueFineInfoCnt3( (Integer) taxPrev3mthsOverdueFineInfo.get("overdueFineInfoCnt")); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | // 近3个月滞纳金金额(元) |
| | | JSONObject taxPrev3mthsOverdueFineInfo = (JSONObject) taxPrevMnMthsOverdueFineInfoDict.get("taxPrev3mthsOverdueFineInfo"); |
| | | taxVO.setOverdueFineInfoCnt3( (Integer) taxPrev3mthsOverdueFineInfo.get("overdueFineInfoCnt")); |
| | | |
| | | |
| | | //近12月0申报月数(月数) |
| | | JSONObject taxPrevMnMthsAllTaxDclrInfoDict = (JSONObject) taxInfo.get("taxPrevMnMthsAllTaxDclrInfoDict"); |
| | | JSONObject taxPrev12mthsAllTaxDclrInfoDict = (JSONObject) taxPrevMnMthsAllTaxDclrInfoDict.get("taxPrev12mthsAllTaxDclrInfoDict"); |
| | | taxVO.setVatTax0dclrMonCnt( (Integer) taxPrev12mthsAllTaxDclrInfoDict.get("vatTax0dclrMonCnt")); |
| | | JSONObject taxPrevMnMthsAllTaxDclrInfoDict = taxInfo.getJSONObject("taxPrevMnMthsAllTaxDclrInfoDict"); |
| | | if (null != taxPrevMnMthsAllTaxDclrInfoDict){ |
| | | JSONObject taxPrev12mthsAllTaxDclrInfoDict = (JSONObject) taxPrevMnMthsAllTaxDclrInfoDict.get("taxPrev12mthsAllTaxDclrInfoDict"); |
| | | taxVO.setVatTax0dclrMonCnt( (Integer) taxPrev12mthsAllTaxDclrInfoDict.get("vatTax0dclrMonCnt")); |
| | | } |
| | | |
| | | |
| | | return R.ok(taxVO); |
| | | } |
| | |
| | | @Override |
| | | public R invoice(String id) { |
| | | InvoiceVO vo = new InvoiceVO(); |
| | | /* Company companyInfo = companyMapper.selectById(id); |
| | | Company companyInfo = companyMapper.selectById(id); |
| | | if (null == companyInfo || companyInfo.getIsDelete() != 0) { |
| | | throw new ServiceException("公司不存在"); |
| | | }*/ |
| | | // JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]); |
| | | JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | } |
| | | JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]); |
| | | // JSONObject jsonObject=getReport("ZZD20250508017232394218445"); |
| | | if (!"1001".equals(jsonObject.getString("code"))){ |
| | | return R.fail(jsonObject.get("msg")); |
| | | } |
| | |
| | | order.setRefundTime(LocalDateTime.now()); |
| | | companyMapper.updateById(company); |
| | | }else{ |
| | | // 判断是否能退 |
| | | if(order.getShareUserId()!=null){ |
| | | User user = appUserMapper.selectById(order.getShareUserId()); |
| | | if(user.getBalance().doubleValue()<order.getCommissionPrice().doubleValue()){ |
| | | throw new ServiceException("退款失败,卖家上级余额不足"); |
| | | } |
| | | } |
| | | |
| | | |
| | | R r = refundPayMoney(order);//退款 |
| | | if (200 == r.getCode()) { |
| | | //退款申请成功 |
| | |
| | | order.setIsRefund(1); |
| | | order.setRefundTime(LocalDateTime.now()); |
| | | this.baseMapper.updateById(order); |
| | | |
| | | //将分佣次数加回 |
| | | User user = appUserMapper.selectById(order.getUserId()); |
| | | User inviter = appUserMapper.selectById(user.getInviteId()); |
| | | User inviter = appUserMapper.selectById(company.getUserId()); |
| | | if (inviter!=null && inviter.getIsDelete()==0){ |
| | | inviter.setInviteNum(inviter.getInviteNum()+1); |
| | | appUserMapper.updateById(inviter); |
| | | } |
| | | |
| | | // 分佣退回 |
| | | if(order.getShareUserId()!=null && order.getCommissionPrice().doubleValue()>0){ |
| | | User user = appUserMapper.selectById(order.getShareUserId()); |
| | | user.setBalance(user.getBalance().subtract(order.getCommissionPrice())); |
| | | appUserMapper.updateById(user); |
| | | AccountDetail accountDetail = new AccountDetail(); |
| | | accountDetail.setUserId(order.getShareUserId()); |
| | | accountDetail.setType(2); |
| | | accountDetail.setCategory(4); |
| | | accountDetail.setSourceId(order.getId()); |
| | | accountDetail.setMoney(order.getCommissionPrice()); |
| | | accountDetail.setRemark("订单取消分佣退回"); |
| | | accountDetailMapper.insert(accountDetail); |
| | | } |
| | | |
| | | //商品状态修改 |
| | |
| | | |
| | | @Override |
| | | public FinanceFlowsTopVO financeTop(FinanceFlowsDTO dto) { |
| | | return this.baseMapper.financeTop(dto); |
| | | FinanceFlowsTopVO financeFlowsTopVO = this.baseMapper.financeTop(dto); |
| | | return financeFlowsTopVO; |
| | | } |
| | | |
| | | @Override |