From ad0b0dde969cdb8939e9f34c4eb951d79d1dd939 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 24 九月 2024 14:07:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 55 +++++++++ ruoyi-service/ruoyi-other/src/main/resources/template/集团用户数据.xlsx | 0 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TChargingGunMapper.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 2 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java | 11 + ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/GunStatusStatisticsVO.java | 2 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java | 20 -- ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java | 4 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java | 6 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java | 5 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java | 23 ++- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java | 8 ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TChargingGunMapper.xml | 9 ruoyi-service/ruoyi-other/pom.xml | 7 + ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 50 ++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/TEnterpriseExport.java | 36 ++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java | 64 ++++++++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java | 42 ++++++ 20 files changed, 302 insertions(+), 48 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java index 24cacf9..f875a8c 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/AppUserInfoDto.java @@ -1,5 +1,6 @@ package com.ruoyi.account.api.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.account.api.model.TAppUserCar; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; @@ -16,6 +17,7 @@ @ApiModelProperty("最低会员价格") private BigDecimal minPrice; @ApiModelProperty("vip结束时间") + @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime vipExpireTime; @ApiModelProperty("当天是否签到") private Integer isSign; diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java index 32db936..90375e1 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.web.domain.BasePojo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -53,7 +54,9 @@ private Integer vipId; @ApiModelProperty(value = "会员到期时间") + @TableField("vip_end_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime vipEndTime; @ApiModelProperty(value = "单位id") @@ -123,6 +126,10 @@ @ApiModelProperty(value = "标签名称") @TableField(exist = false) private String tagName; + + @ApiModelProperty(value = "单位名称") + @TableField(exist = false) + private String companyName; @ApiModelProperty(value = "vip名称") @TableField(exist = false) private String vipName; @@ -136,9 +143,7 @@ @ApiModelProperty("剩余天数") @TableField(exist = false) private Long lastDays; - @ApiModelProperty(value = "单位名称") - @TableField(exist = false) - private String companyName; + } diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java index ffc516b..72e134f 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java @@ -73,7 +73,9 @@ @TableField("send_month") private Integer sendMonth; - + @ApiModelProperty(value = "当时购买的vipJson") + @TableField("vip_json") + private String vipJson; @ApiModelProperty(value = "要赠送的优惠卷") @TableField("coupon_ids") private String couponIds; diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/GunStatusStatisticsVO.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/GunStatusStatisticsVO.java index fe534cb..1fa2248 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/GunStatusStatisticsVO.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/GunStatusStatisticsVO.java @@ -13,7 +13,7 @@ public class GunStatusStatisticsVO implements Serializable { @ApiModelProperty(value = "充电桩类型统计 key:充电模式(1=超级快充,2=快充,3=慢充)") - private Map<Integer,Integer> modeStatistics; + private List<Map<Integer,Integer>> modeStatistics; @ApiModelProperty(value = "状态统计 key:充电模式(1=离线,2=故障,3=充电中)") private Map<Integer,Integer> statusStatistics; @ApiModelProperty(value = "状态统计根据类型分组") diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java index 044ac01..32ee877 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TCompany; import com.ruoyi.other.api.domain.TCoupon; +import com.ruoyi.other.api.domain.TEnterpriseUserApplication; import com.ruoyi.other.api.domain.TUserTag; import com.ruoyi.other.api.dto.TagListQueryDto; import com.ruoyi.other.api.dto.UnitListQueryDto; @@ -91,6 +92,11 @@ public R<TCoupon> getCouponById(Integer id) { return R.fail("查询优惠卷:"+throwable.getMessage()); } + + @Override + public R<List<TEnterpriseUserApplication>> getTnterPrise() { + return R.fail("查询:"+throwable.getMessage()); + } }; } } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java index 436a6d1..3c08f02 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java @@ -3,19 +3,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; -import com.ruoyi.other.api.domain.TCompany; -import com.ruoyi.other.api.domain.TCoupon; -import com.ruoyi.other.api.domain.TInvoiceType; -import com.ruoyi.other.api.domain.TUserTag; +import com.ruoyi.other.api.domain.*; import com.ruoyi.other.api.dto.TagListQueryDto; import com.ruoyi.other.api.dto.UnitListQueryDto; import com.ruoyi.other.api.factory.OtherFallbackFactory; import com.ruoyi.other.api.vo.CouponListVOVO; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; @@ -71,12 +65,6 @@ @PostMapping(value = "/t-coupon/getCouponById") R<TCoupon> getCouponById(@RequestParam("id") Integer id); - - - - - - - - + @PutMapping(value = "/t-enterprise-user-application/export") + R<List<TEnterpriseUserApplication>> getTnterPrise(); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java index 2a5267a..6d7b268 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java @@ -446,12 +446,21 @@ pointsQueryDto.setUserId(tokenService.getLoginUserApplet().getUserId()); } List<Integer> types = new ArrayList<>(); - if (pointsQueryDto.getType()!=null){ + if (pointsQueryDto.getType()==null){ types.add(1); types.add(2); types.add(3); types.add(4); types.add(5); + types.add(6); + }else if (pointsQueryDto.getType()==1){ + types.add(1); + types.add(2); + types.add(3); + types.add(4); + types.add(5); + }else if (pointsQueryDto.getType()==2){ + types.add(6); } Page<TAppUserIntegralChange> page = integralChangeService.lambdaQuery() .eq(TAppUserIntegralChange::getAppUserId, pointsQueryDto.getUserId()) @@ -775,6 +784,17 @@ if (signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).eq(TAppUserSign::getAppUserId, userId).count()>0){ return R.fail("今日已签到"); } + + //判断当前生效的vipDetail + TAppUserVipDetail one = tAppUserVipDetailService.lambdaQuery().le(TAppUserVipDetail::getStartTime, LocalDateTime.now()).ge(TAppUserVipDetail::getEndTime, LocalDateTime.now()).eq(TAppUserVipDetail::getAppUserId, userId).last("limit 1").one(); + boolean doubleVip = false; + if (one!=null){ + TVip tVip = JSONObject.parseObject(one.getVipJson(), TVip.class); + if (tVip.getDoubleIntegration()==1){ + doubleVip = true; + } + } + //签到业务 TAppUserSign appUserSign = new TAppUserSign(); appUserSign.setSignDay(LocalDate.now()); @@ -790,6 +810,9 @@ Integer points = 0; Integer point = jsonObject.getInteger("num1"); points= points+point; + if (doubleVip){ + points= points+point; + } JSONArray num2 = jsonObject.getJSONArray("num2"); if (num2!=null) { //获取连续签到的规则放入map @@ -804,6 +827,9 @@ Integer i = map.get(days); if (i!=null){ points= points+i; + if (doubleVip){ + points= points+i; + } appUserSign.setIsGift(1); signService.updateById(appUserSign); } @@ -874,6 +900,16 @@ TAppUser byId = appUserService.getById(userId); appUserCar.setAppUserId(userId); + //判断当前生效的vipDetail + TAppUserVipDetail one = tAppUserVipDetailService.lambdaQuery().le(TAppUserVipDetail::getStartTime, LocalDateTime.now()).ge(TAppUserVipDetail::getEndTime, LocalDateTime.now()).eq(TAppUserVipDetail::getAppUserId, userId).last("limit 1").one(); + boolean doubleVip = false; + if (one!=null){ + TVip tVip = JSONObject.parseObject(one.getVipJson(), TVip.class); + if (tVip.getDoubleIntegration()==1){ + doubleVip = true; + } + } + //如果是第一次添加车辆,增加积分 Long count = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).count(); @@ -887,17 +923,29 @@ Integer point = 0; //增加车牌50分,必填 point = point+jsonObject.getInteger("num1"); + if (doubleVip){ + point = point+jsonObject.getInteger("num1"); + } //增加车型分 if (StringUtils.isNotEmpty(appUserCar.getVehicleModel())){ point = point+jsonObject.getInteger("num2"); + if (doubleVip){ + point = point+jsonObject.getInteger("num2"); + } } //增加车辆用途分 if (StringUtils.isNotEmpty(appUserCar.getVehicleUse())){ point = point+jsonObject.getInteger("num3"); + if (doubleVip){ + point = point+jsonObject.getInteger("num3"); + } } //增加续航分 if (StringUtils.isNotEmpty(appUserCar.getEndurance())){ point = point+jsonObject.getInteger("num4"); + if (doubleVip){ + point = point+jsonObject.getInteger("num4"); + } } //增加积分记录 diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java index ef92923..4090c02 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java @@ -55,6 +55,7 @@ tAppUserVipDetail.setChargeNum(vip.getDiscountTimes()); tAppUserVipDetail.setDiscountMoney(vip.getMaximumDeduction()); tAppUserVipDetail.setSendMonth(1); + tAppUserVipDetail.setVipJson(JSON.toJSONString(info.getData())); tAppUserVipDetailService.save(tAppUserVipDetail); //直接赠送优惠卷 for (SendCouponDto sendCouponDto : javaList) { @@ -116,6 +117,7 @@ tAppUserVipDetail1.setChargeNum(vip.getDiscountTimes()); tAppUserVipDetail1.setDiscountMoney(vip.getMaximumDeduction()); tAppUserVipDetail1.setSendMonth(1); + tAppUserVipDetail.setVipJson(JSON.toJSONString(info.getData())); tAppUserVipDetailService.save(tAppUserVipDetail1); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TChargingGunMapper.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TChargingGunMapper.java index 146e826..1dfd10a 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TChargingGunMapper.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TChargingGunMapper.java @@ -37,7 +37,7 @@ * @param siteIds * @return */ - Map<Integer, Integer> getModeStatistics(@Param("siteIds")List<Integer> siteIds); + List<Map<Integer, Integer>> getModeStatistics(@Param("siteIds")List<Integer> siteIds); /** * 统计充电枪状态 diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java index 1918cc5..02184c2 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java @@ -186,10 +186,10 @@ GunStatusStatisticsVO gunStatusStatisticsVO = new GunStatusStatisticsVO(); if(CollectionUtils.isEmpty(siteIds)){ - Map<Integer, Integer> modeStatisticsNull = new HashMap<>(); - modeStatisticsNull.put(1, 0); - modeStatisticsNull.put(2, 0); - modeStatisticsNull.put(3, 0); + List<Map<Integer, Integer>> modeStatisticsNull = new ArrayList<>(); + modeStatisticsNull.add(new HashMap<>(1,0)); + modeStatisticsNull.add(new HashMap<>(2,0)); + modeStatisticsNull.add(new HashMap<>(3,0)); gunStatusStatisticsVO.setModeStatistics(modeStatisticsNull); Map<Integer, Integer> statusStatisticsNull = new HashMap<>(); statusStatisticsNull.put(1, 0); @@ -209,22 +209,27 @@ gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatistics); } - Map<Integer, Integer> modeStatistics = this.baseMapper.getModeStatistics(siteIds); + List<Map<Integer, Integer>> modeStatistics = this.baseMapper.getModeStatistics(siteIds); gunStatusStatisticsVO.setModeStatistics(modeStatistics); - Map<Integer, Integer> statusStatistics = new HashMap<>(); + List<Map<Integer, Integer>> statusStatistics = new ArrayList<>(); // 离线 Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class) .eq(TChargingGun::getStatus, 1)); - statusStatistics.put(1, count.intValue()); + statusStatistics.add(new HashMap<>(1,count.intValue())); +// statusStatistics.put(1, count.intValue()); // 故障 count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class) .eq(TChargingGun::getStatus, 7)); - statusStatistics.put(2, count.intValue()); + statusStatistics.add(new HashMap<>(2,count.intValue())); + +// statusStatistics.put(2, count.intValue()); // 充电中 count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class) .in(TChargingGun::getStatus, Arrays.asList(3,4,5,6))); - statusStatistics.put(3, count.intValue()); + statusStatistics.add(new HashMap<>(3,count.intValue())); + +// statusStatistics.put(3, count.intValue()); gunStatusStatisticsVO.setModeStatistics(statusStatistics); List<StatusModeStatisticsVO> statusModeStatisticsVOS = new ArrayList<>(); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TChargingGunMapper.xml b/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TChargingGunMapper.xml index a3e2a10..900f562 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TChargingGunMapper.xml +++ b/ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TChargingGunMapper.xml @@ -85,10 +85,10 @@ <select id="getStatusModeStatistics" resultType="com.ruoyi.chargingPile.api.vo.StatusModeStatisticsVO"> SELECT charge_mode, - IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 2),0) AS freeCount, - IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 5),0) AS filledCount, - IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 3),0) AS insertCount, - IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 4),0) AS chargingCount + IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 2),0) AS freeCount, + IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 5),0) AS filledCount, + IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 3),0) AS insertCount, + IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 4),0) AS chargingCount FROM t_charging_gun WHERE del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND charge_mode = #{chargeMode} <if test="siteIds != null and siteIds.size()>0"> @@ -97,6 +97,7 @@ #{siteId} </foreach> </if> + GROUP BY charge_mode </select> </mapper> diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java index 74c4dfc..909cf73 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TVipOrderController.java @@ -1,24 +1,40 @@ package com.ruoyi.order.controller; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; import com.ruoyi.account.api.dto.GiveVipDto; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.WebUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.order.api.model.TExchangeOrder; import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.order.api.model.TVipOrder; import com.ruoyi.order.api.query.ShoppingOrderQuery; import com.ruoyi.order.api.query.VipShoppingOrderQuery; +import com.ruoyi.order.dto.TEnterpriseExport; import com.ruoyi.order.service.TVipOrderService; +import com.ruoyi.other.api.domain.TEnterpriseUserApplication; +import com.ruoyi.other.api.feignClient.OtherClient; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.poi.ss.usermodel.Workbook; import org.omg.CORBA.PRIVATE_MEMBER; +import org.springframework.beans.BeanUtils; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -85,5 +101,51 @@ } -} + @Resource + private OtherClient otherClient; + + @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") + @PutMapping(value = "/export") + @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) + public void export(String landlordPhone) { + + R<List<TEnterpriseUserApplication>> tnterPrise = otherClient.getTnterPrise(); + List<TEnterpriseUserApplication> list = tnterPrise.getData(); + List<TEnterpriseExport> orderInvoiceExports = new ArrayList<>(); + for (TEnterpriseUserApplication orderInvoiceVO : list) { + TEnterpriseExport orderInvoiceExport = new TEnterpriseExport(); + BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); + orderInvoiceExport.setCreateTime(DateUtils.localDateTimeToString(orderInvoiceVO.getCreateTime())); + orderInvoiceExports.add(orderInvoiceExport); + } + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TEnterpriseExport.class, orderInvoiceExports); + HttpServletResponse response = WebUtils.response(); + response.setCharacterEncoding("utf-8"); + ServletOutputStream outputStream = null; + try { + String fileName = URLEncoder.encode("集团用户导出.xls", "utf-8"); + response.setHeader("Content-Disposition", "attachment;filename=" + fileName); + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Cache-Control", "no-cache"); + outputStream = response.getOutputStream(); + workbook.write(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + workbook.close(); + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + } + + + + + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/TEnterpriseExport.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/TEnterpriseExport.java new file mode 100644 index 0000000..bc75ad7 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/TEnterpriseExport.java @@ -0,0 +1,36 @@ +package com.ruoyi.order.dto; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@ApiModel(value = "导出公司") +public class TEnterpriseExport implements Serializable { + + @Excel(name = "公司名称",width = 30) + private String companyName; + @Excel(name = "新能源电动汽车保有量",width = 30) + private Integer vehiclesNumber; + @Excel(name = "联系人",width = 30) + private String contactName; + @Excel(name = "联系电话",width = 30) + private String phone; + @Excel(name = "备注",width = 30) + private String remark; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "申请时间",width = 30,exportFormat="yyyy-MM-dd HH:mm:ss") + private String createTime; + + + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 61b4ae3..660a07e 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -1706,6 +1706,8 @@ } + @Resource + private TShoppingOrderService shoppingOrderService; @Override public R payRefund(PayOrderRefundDto payOrderQueryDto) { if (payOrderQueryDto.getType()==1){ @@ -1763,10 +1765,61 @@ } + if (payOrderQueryDto.getType()==2){ + TShoppingOrder tChargingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); + TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); + chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); + chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); + chargingOrderRefund.setRefundStatus(1); + chargingOrderRefund.setPayType(tChargingOrder.getPaymentType()); + chargingOrderRefund.setRefundTime(LocalDateTime.now()); + chargingOrderRefund.setCode(tChargingOrder.getCode()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); + chargingOrderRefund.setRefundTitle("后台退款"); + chargingOrderRefund.setRefundContent("后台退款"); + chargingOrderRefund.setRefundReason("后台退款"); + chargingOrderRefund.setRefundRemark("后台退款"); + chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); + chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); + + if(1 == tChargingOrder.getPaymentType()){ + WxPaymentRefundModel model = new WxPaymentRefundModel(); + model.setOut_trade_no(tChargingOrder.getCode()); + model.setOut_refund_no(chargingOrderRefund.getRefundCode()); + model.setTransaction_id(tChargingOrder.getSerialNumber()); + model.setReason("取消订单"); + model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); + WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); + amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); + amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); + amount.setCurrency("CNY"); + model.setAmount(amount); + R<String> orderR = wxPaymentClient.refundOrderR(model); + if(200 == orderR.getCode()){ + chargingOrderRefundService.save(chargingOrderRefund); + } + } + + if(2 == tChargingOrder.getPaymentType()){ + RefundReq dto = new RefundReq(); + dto.setOutTradeNo(tChargingOrder.getCode()); + dto.setOutRequestNo(tChargingOrder.getCode()); + dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); + dto.setRefundReason("取消订单"); + RefundResp resp = aliPaymentClient.refund(dto).getData(); + if(null != resp){ + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); + chargingOrderRefundService.save(chargingOrderRefund); + + } + } + + } - return null; + return R.ok(); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java index 2f05e87..102b6f1 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java @@ -223,9 +223,11 @@ dto.setSiteName(site.getName()); List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, dto.getId())); List<Integer> tagIds = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); - List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); - List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); - dto.setTags(collect); + if(tagIds.size() > 0){ + List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); + List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); + dto.setTags(collect); + } } return pageInfo.setRecords(list); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java index 843efa2..75e28c4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java @@ -461,7 +461,7 @@ name = goods.getName(); imgUrl = goods.getCoverPicture(); }else{ - TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getGoodsId()).getData(); + TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getCouponId()).getData(); name = coupon.getName(); imgUrl = coupon.getCoverPicture(); } diff --git a/ruoyi-service/ruoyi-other/pom.xml b/ruoyi-service/ruoyi-other/pom.xml index 0944dbe..dff5ae9 100644 --- a/ruoyi-service/ruoyi-other/pom.xml +++ b/ruoyi-service/ruoyi-other/pom.xml @@ -15,7 +15,6 @@ </description> <dependencies> - <!-- SpringCloud Alibaba Nacos --> <dependency> <groupId>com.alibaba.cloud</groupId> @@ -135,6 +134,12 @@ <groupId>com.ruoyi</groupId> <artifactId>ruoyi-api-payment</artifactId> </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>easyexcel-core</artifactId> + <version>RELEASE</version> + <scope>compile</scope> + </dependency> </dependencies> <build> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java index 8be32f5..f050fa6 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TEnterpriseUserApplicationController.java @@ -8,17 +8,18 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; -import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.TEnterpriseUserApplication; import com.ruoyi.other.query.PassDto; import com.ruoyi.other.service.TEnterpriseUserApplicationService; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -81,8 +82,43 @@ return R.ok(page); // } } - - + + + @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") + @PutMapping(value = "/export") + @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) + public R<List<TEnterpriseUserApplication>> export() { + + + List<TEnterpriseUserApplication> list = enterpriseUserApplicationService.lambdaQuery().list(); + + return R.ok(list); +// Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TEnterpriseExport.class, orderInvoiceExports); +// HttpServletResponse response = WebUtils.response(); +// response.setCharacterEncoding("utf-8"); +// ServletOutputStream outputStream = null; +// try { +// String fileName = URLEncoder.encode("公司导出.xls", "utf-8"); +// response.setHeader("Content-Disposition", "attachment;filename=" + fileName); +// response.setContentType("application/vnd.ms-excel;charset=UTF-8"); +// response.setHeader("Pragma", "no-cache"); +// response.setHeader("Cache-Control", "no-cache"); +// outputStream = response.getOutputStream(); +// workbook.write(outputStream); +// } catch (IOException e) { +// e.printStackTrace(); +// } finally { +// try { +// workbook.close(); +// outputStream.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } + } + + + @Log(title = "【集团用户申请】填写备注", businessType = BusinessType.INSERT) @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") @PostMapping(value = "/remark") diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java index dc20ae9..cc56da3 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -49,7 +50,7 @@ HttpServletResponse response = (HttpServletResponse) servletResponse; String userid = request.getHeader("user_id"); if(StringUtils.isEmpty(userid)){ - filterChain.doFilter(request, response); + filterChain.doFilter(servletRequest, servletResponse); return; } String userType = request.getHeader("user_type"); @@ -81,7 +82,7 @@ return; } } - filterChain.doFilter(request, response); + filterChain.doFilter(servletRequest, servletResponse); } diff --git "a/ruoyi-service/ruoyi-other/src/main/resources/template/\351\233\206\345\233\242\347\224\250\346\210\267\346\225\260\346\215\256.xlsx" "b/ruoyi-service/ruoyi-other/src/main/resources/template/\351\233\206\345\233\242\347\224\250\346\210\267\346\225\260\346\215\256.xlsx" new file mode 100644 index 0000000..b1b4bf0 --- /dev/null +++ "b/ruoyi-service/ruoyi-other/src/main/resources/template/\351\233\206\345\233\242\347\224\250\346\210\267\346\225\260\346\215\256.xlsx" Binary files differ -- Gitblit v1.7.1