From 727bd67e564a447ced5d42e11e87315bd6ee5db4 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期五, 25 十月 2024 09:45:55 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 89 ++++++--- ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java | 2 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/TaskUtil.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 78 +++++--- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TActivityStatisticslVO.java | 2 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TChargingGun.java | 4 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 53 +++-- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java | 85 ++++++--- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java | 13 + ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 6 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 23 ++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderAccountingStrategy.java | 8 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml | 21 + ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 10 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java | 6 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 6 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java | 32 +++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 30 +++ ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/PartnerServiceImpl.java | 10 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 1 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java | 4 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 26 ++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java | 2 23 files changed, 360 insertions(+), 153 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TChargingGun.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TChargingGun.java index 65a9109..b6f5cbc 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TChargingGun.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TChargingGun.java @@ -114,5 +114,9 @@ @ApiModelProperty(value = "已充电百分比") @TableField(exist = false) private Integer soc; + + @ApiModelProperty(value = "完整编号(桩号+抢号)") + @TableField("fullNumber") + private String fullNumber; } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java index ab55bc6..20929f8 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.dto.ExchangeDto; import com.ruoyi.order.api.feignClient.OrderClient; import com.ruoyi.order.api.model.ChargingListQuery; +import com.ruoyi.order.api.model.TGrantVip; import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.order.api.model.TVipOrder; import com.ruoyi.order.api.query.TActivityStatisticsQuery; @@ -35,6 +36,11 @@ @Override + public R managementGiveVip(TGrantVip grantVip) { + return R.fail("管理后台赠送会员:" + cause.getMessage()); + } + + @Override public R<List<Integer>> getSalesCountByGoodsId(String goodsIds) { return R.fail("根据商品订单ids查询销量:" + cause.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java index 300a830..210327e 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.dto.ExchangeDto; import com.ruoyi.order.api.factory.OrderFallbackFactory; import com.ruoyi.order.api.model.ChargingListQuery; +import com.ruoyi.order.api.model.TGrantVip; import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.order.api.model.TVipOrder; import com.ruoyi.order.api.query.TActivityStatisticsQuery; @@ -23,7 +24,8 @@ */ @FeignClient(contextId = "OrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderFallbackFactory.class) public interface OrderClient { - + @PostMapping(value = "/t-charging-order/management/give/vip") + public R managementGiveVip(@RequestBody TGrantVip grantVip); @GetMapping("/t-exchange-order/getSalesCountByGoodsIds/{goodsIds}") R<List<Integer>> getSalesCountByGoodsId(@PathVariable("goodsIds") String goodsIds); diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderAccountingStrategy.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderAccountingStrategy.java index b949598..39f3408 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderAccountingStrategy.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderAccountingStrategy.java @@ -82,6 +82,14 @@ @TableField("period_original_service_price") private BigDecimal periodOriginalServicePrice; + @ApiModelProperty(value = "优惠券抵扣金额") + @TableField("coupon_discount_amount") + private BigDecimal couponDiscountAmount; + + @ApiModelProperty(value = "会员优惠金额") + @TableField("vip_discount_amount") + private BigDecimal vipDiscountAmount; + @ApiModelProperty(value = "首次添加时间") @TableField("create_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java index c97801a..8fabc3d 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java @@ -14,6 +14,8 @@ public class ChargingBillListVO extends TChargingBill { @ApiModelProperty(value = "账单周期") private String billWeek; + @ApiModelProperty(value = "账户类型名称") + private String payTypeName; @ApiModelProperty(value = "充电时间 秒") private Integer chargingSecond; diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TActivityStatisticslVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TActivityStatisticslVO.java index b443083..29445d2 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TActivityStatisticslVO.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TActivityStatisticslVO.java @@ -17,6 +17,8 @@ @ApiModelProperty(value = "用户手机号") private String phone; + @ApiModelProperty(value = "用户id") + private Long appUserId; @ApiModelProperty(value = "参与类型 优惠券 会员抵扣 会员活动 赠送会员") private String type; diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java index 20f98de..acc6b84 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java @@ -100,7 +100,7 @@ * @param user */ @PostMapping("/user/addSysUser") - R addSysUser(@RequestBody SysUser user); + R<Long> addSysUser(@RequestBody SysUser user); /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index 752e3d0..30e4c24 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -679,16 +679,16 @@ @ResponseBody @PostMapping("/addSysUser") @Transactional(rollbackFor = Exception.class) - public R addSysUser(@RequestBody SysUser user) { + public R<Long> addSysUser(@RequestBody SysUser user) { if(StringUtils.isEmpty(user.getUserName())){ user.setUserName(user.getPhonenumber()); } if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ user.setNickName(user.getPhonenumber()); } - if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { - throw new RuntimeException("手机号已开通账号"); - } +// if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { +// throw new RuntimeException("手机号已开通账号"); +// } if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { throw new RuntimeException("登录账号已存在"); } @@ -702,7 +702,7 @@ sysUserRole.setRoleId(user.getRoleId()); sysUserRole.setUserId(user.getUserId()); userRoleService.insertSysUserRole(sysUserRole); - return R.ok(); + return R.ok(user.getUserId()); } 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 a483474..f06c968 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 @@ -19,6 +19,7 @@ import com.ruoyi.common.core.dto.PointChangeDto; import com.ruoyi.common.core.enums.status.AppUserStatusEnum; import com.ruoyi.common.core.utils.JwtUtils; +import com.ruoyi.common.core.utils.OrderCodeUtil; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -33,8 +34,10 @@ import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.order.api.feignClient.ChargingOrderClient; import com.ruoyi.order.api.feignClient.ExchangeOrderClient; +import com.ruoyi.order.api.feignClient.OrderClient; import com.ruoyi.order.api.model.TChargingOrder; import com.ruoyi.order.api.model.TExchangeOrder; +import com.ruoyi.order.api.model.TGrantVip; import com.ruoyi.other.api.domain.*; import com.ruoyi.other.api.domain.TCoupon; import com.ruoyi.other.api.dto.UnitListQueryDto; @@ -51,6 +54,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; import java.time.Duration; import java.time.LocalDate; import java.time.LocalDateTime; @@ -76,6 +80,8 @@ private TAppUserService appUserService; @Resource private TAppUserTagService appUserTagService; + @Autowired + private OrderClient orderClient; @Resource private TAppUserVipDetailService tAppUserVipDetailService; @@ -726,9 +732,31 @@ } else if (giveVipDto.getType() == 3) { plusDay = 12; } - //增加vipDetail + BigDecimal bigDecimal = new BigDecimal("0"); + TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData(); + switch (giveVipDto.getType()){ + case 1: + bigDecimal = bigDecimal.add(info.getMonthlyCard()); + break; + case 2: + bigDecimal = bigDecimal.add(info.getSeasonCard()); + break; + case 3: + bigDecimal = bigDecimal.add(info.getAnnualCard()); + break; + } + //增加vipDetail giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType()); appUserService.updateById(nowUser); + // 新增后台赠送记录 + TGrantVip tGrantVip = new TGrantVip(); + tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS")); + tGrantVip.setAppUserId(nowUser.getId()); + tGrantVip.setVipId(giveVipDto.getVipId()); + tGrantVip.setOrderAmount(bigDecimal); + tGrantVip.setCreateTime(LocalDateTime.now()); + tGrantVip.setAppUserId(nowUser.getId()); + orderClient.managementGiveVip(tGrantVip); } return R.ok(); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index dc9f996..37e4f92 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -110,10 +110,8 @@ @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"}) public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){ SiteInfoVO siteInfoVO = new SiteInfoVO(); - String chargingPileCode = number.substring(0, number.length() - 2); - String chargingGunCode = number.substring(number.length() - 2); - TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getCode, chargingPileCode).one(); - TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, chargingGunCode).eq(TChargingGun::getChargingPileId, one.getId())); + TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, number)); + TChargingPile one = chargingPileService.getById(chargingGun.getChargingPileId()); Site byId = siteService.getById(one.getSiteId()); TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId()); List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list(); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java index 5654d26..0f54b24 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; +import com.ruoyi.chargingPile.api.model.TFaultMessage; import com.ruoyi.chargingPile.api.query.TChargingGunQuery; import com.ruoyi.chargingPile.api.vo.TChargingGunVO; import com.ruoyi.chargingPile.dto.ChargeMonitoring; @@ -39,6 +40,7 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -61,6 +63,9 @@ @Resource private RedisService redisService; + + @Resource + private TFaultMessageService faultMessageService; @Autowired @@ -218,9 +223,30 @@ TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>() .eq(TChargingPile::getCode, code).eq(TChargingPile::getDelFlag, 0)); if(null != chargingPile){ - chargingPile.setStatus(0 == status ? 1 : 3); - chargingPileService.updateById(chargingPile); - redisService.getCacheMap("charging_pile_online").put(code, System.currentTimeMillis()); + if(chargingPile.getStatus() == 1){ + TFaultMessage faultMessage = new TFaultMessage(); + faultMessage.setSiteId(chargingPile.getSiteId()); + faultMessage.setChargingPileId(chargingPile.getId()); + faultMessage.setStatus(1); + faultMessage.setDownTime(LocalDateTime.now()); + faultMessage.setCreateTime(LocalDateTime.now()); + faultMessage.setDelFlag(false); + faultMessage.setContent("设备离线"); + faultMessageService.save(faultMessage); + + chargingPile.setStatus(0 == status ? 1 : 3); + chargingPileService.updateById(chargingPile); + } + if(chargingPile.getStatus() != 1 && 0 == status){ + TFaultMessage one = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()).isNull(TFaultMessage::getEndTime)); + if(null != one){ + one.setEndTime(LocalDateTime.now()); + faultMessageService.updateById(one); + } + } + if(0 == status){ + redisService.getCacheMap("charging_pile_online").put(code, System.currentTimeMillis()); + } } } } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/PartnerServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/PartnerServiceImpl.java index 7ee4de8..e02da4e 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/PartnerServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/PartnerServiceImpl.java @@ -145,13 +145,15 @@ user.setDelFlag("0"); user.setRoleId(partner.getRoleId().longValue()); user.setRoleType(2); - //添加新数据 - this.save(partner); - user.setObjectId(partner.getId()); - R r = sysUserClient.addSysUser(user); + R<Long> r = sysUserClient.addSysUser(user); if(200 != r.getCode()){ throw new RuntimeException(r.getMsg()); } + //添加新数据 + this.save(partner); + user = sysUserClient.getSysUser(r.getData()).getData(); + user.setObjectId(partner.getId()); + sysUserClient.updateUser(user); return AjaxResult.success(); } 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 5fda203..dcea1b1 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 @@ -136,8 +136,9 @@ if(count > 0){ return AjaxResult.error("接口编码已存在"); } - this.save(dto); TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); + dto.setFullNumber(chargingPile.getCode() + dto.getCode()); + this.save(dto); //下发硬件充电二维码 String code_prefix = "https://mxcd.zhinenganguan.com?No="; @@ -173,8 +174,9 @@ if(null != one && !dto.getId().equals(one.getId())){ return AjaxResult.error("接口编码已存在"); } - this.updateById(dto); TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); + dto.setFullNumber(chargingPile.getCode() + dto.getCode()); + this.updateById(dto); //下发硬件充电二维码 String code_prefix = "https://mxcd.zhinenganguan.com?No="; diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java index eca82dd..5a8e7ee 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java @@ -9,6 +9,7 @@ import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; +import com.ruoyi.chargingPile.api.model.TFaultMessage; import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; import com.ruoyi.chargingPile.api.query.PageChargingPileList; import com.ruoyi.chargingPile.api.vo.TChargingGunVO; @@ -19,10 +20,7 @@ import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; import com.ruoyi.chargingPile.mapper.TChargingPileMapper; -import com.ruoyi.chargingPile.service.IPartnerService; -import com.ruoyi.chargingPile.service.ISiteService; -import com.ruoyi.chargingPile.service.TChargingGunService; -import com.ruoyi.chargingPile.service.TChargingPileService; +import com.ruoyi.chargingPile.service.*; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -51,6 +49,7 @@ import java.math.MathContext; import java.math.RoundingMode; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -104,6 +103,9 @@ @Resource private RedisService redisService; + + @Resource + private TFaultMessageService faultMessageService; @@ -586,6 +588,19 @@ } if(datas.size() > 0){ + for (TChargingPile data : datas) { + if(data.getStatus() == 1){ + TFaultMessage faultMessage = new TFaultMessage(); + faultMessage.setSiteId(data.getSiteId()); + faultMessage.setChargingPileId(data.getId()); + faultMessage.setStatus(1); + faultMessage.setDownTime(LocalDateTime.now()); + faultMessage.setCreateTime(LocalDateTime.now()); + faultMessage.setDelFlag(false); + faultMessage.setContent("设备离线"); + faultMessageService.save(faultMessage); + } + } this.updateBatchById(datas); } } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/TaskUtil.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/TaskUtil.java index f544069..fde5053 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/TaskUtil.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/TaskUtil.java @@ -25,6 +25,6 @@ */ @Scheduled(fixedRate = 1000 * 60) public void taskMinute(){ - + chargingPileService.updateStatus(); } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java index 6288179..c1b037f 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java @@ -15,14 +15,11 @@ 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.ExportUidDto; -import com.ruoyi.order.api.model.TChargingBill; -import com.ruoyi.order.api.model.TChargingOrder; +import com.ruoyi.order.api.model.*; import com.ruoyi.order.api.query.TOrderInvoiceQuery; import com.ruoyi.order.api.vo.AccountListVO; import com.ruoyi.order.api.vo.ChargingBillListVO; import com.ruoyi.order.api.vo.ChargingBillVO; -import com.ruoyi.order.api.model.ChargingListQuery; import com.ruoyi.order.api.vo.TOrderInvoiceVO; import com.ruoyi.order.export.*; import com.ruoyi.order.service.*; @@ -30,6 +27,7 @@ import io.swagger.annotations.ApiOperation; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -40,6 +38,7 @@ import java.net.URLEncoder; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; @@ -231,6 +230,9 @@ } } } + + @Autowired + private TChargingOrderRefundService tChargingOrderRefundService; @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) @PutMapping("/download") public void download(@RequestBody ExportUidDto uid) @@ -241,10 +243,9 @@ TChargingBill byId = chargingBillService.getById(uid.getUid()); ChargingBillExport chargingBillExport = new ChargingBillExport(); chargingBillExport.setCode(byId.getCode()); - // todo 确认商户类型 - chargingBillExport.setAccountType("商户类型"); + chargingBillExport.setAccountType("微信商户"); chargingBillExport.setType(byId.getType().toString()); - chargingBillExport.setBillType("月结"); + chargingBillExport.setBillType("月账单"); LocalDateTime billTime = byId.getBillTime(); // 将billTime 减去一个月 转化为yyyy-MM格式字符串 billTime = billTime.minusMonths(1); @@ -256,15 +257,26 @@ if (!data.isEmpty()){ chargingBillExport.setSiteName(data.get(0).getName()); } - // 根据账单的出账时间 查询上个月的充电订单 - LocalDateTime localDate = byId.getBillTime().minusMonths(1); - // 账单周期 +// // 根据账单的出账时间 查询上个月的充电订单 +// LocalDateTime localDate = byId.getBillTime().minusMonths(1); +// // 账单周期 +// // 获取 LocalDate 对象 +// LocalDate date = localDate.toLocalDate(); +// // 获取该月份的第一天 +// LocalDate firstDayOfMonth = date.withDayOfMonth(1); + LocalDateTime localDate = byId.getBillTime().minusDays(1); + // todo 临时修改为前一天 // 获取 LocalDate 对象 LocalDate date = localDate.toLocalDate(); - // 获取该月份的第一天 - LocalDate firstDayOfMonth = date.withDayOfMonth(1); +// // 获取该月份的第一天 +// LocalDate firstDayOfMonth = date.withDayOfMonth(1); +// // 获取该月份的最后一天 +// LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); + // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 + LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); + LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); // 获取该月份的最后一天 - LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); +// LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() .between("create_time", firstDayOfMonth, lastDayOfMonth) .eq("status", 5) @@ -274,10 +286,10 @@ } BigDecimal paymentAmount = new BigDecimal("0"); BigDecimal refundAmount = new BigDecimal("0"); - BigDecimal income = new BigDecimal("0"); List<TChargingOrder> tChargingOrders = chargingOrderService.list(eq); // 累加支付金额 + BigDecimal bigDecimal = new BigDecimal("0"); int i =1; for (TChargingOrder tChargingOrder : tChargingOrders) { // 账单信息 @@ -304,26 +316,43 @@ chargingBillPayExport.setPlatformPay("支付宝小程序支付"); } - chargingBillRefundExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); - chargingBillRefundExport.setCode(tChargingOrder.getCode()); - chargingBillRefundExport.setPayTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime()))); - if (tChargingOrder.getRefundTime()!=null){ - chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getRefundTime()))); + TChargingOrderRefund one = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).one(); + if (one!=null){ + chargingBillRefundExport.setRechargeSerialNumber(one.getSerailNumber()); + chargingBillRefundExport.setCode(one.getCode()); + chargingBillRefundExport.setPayTime(tChargingOrder.getPayTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime())):""); + if (tChargingOrder.getRefundTime()!=null){ + chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getRefundTime()))); + } + chargingBillRefundExport.setRefundMoney(one.getRefundAmount().toString()); + chargingBillRefundExport.setRefundRemark(one.getRefundReason()); + chargingBillRefundExport.setRefundCode(one.getRefundCode()); + chargingBillRefundExport.setRefundSerialNumber(one.getRefundSerialNumber()); + chargingBillRefundExports.add(chargingBillRefundExport); } - chargingBillRefundExport.setRefundMoney(tChargingOrder.getRefundAmount().toString()); - chargingBillRefundExport.setRefundRemark(tChargingOrder.getRefundReason()); - chargingBillRefundExport.setRefundCode(tChargingOrder.getRefundCode()); - chargingBillRefundExport.setRefundSerialNumber(tChargingOrder.getRefundSerialNumber()); - chargingBillRefundExports.add(chargingBillRefundExport); // 支付信息 chargingBillPayExport.setId(i+""); chargingBillPayExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); chargingBillPayExport.setCode(tChargingOrder.getCode()); - chargingBillPayExport.setPayTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime()))); - chargingBillPayExport.setPaymentAmount(tChargingOrder.getPaymentAmount().toString()); + chargingBillPayExport.setPayTime(tChargingOrder.getPayTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime())):""); + chargingBillPayExport.setPaymentAmount(tChargingOrder.getOrderAmount().toString()); chargingBillPayExport.setTotal(""); chargingBillPayExports.add(chargingBillPayExport); i++; + bigDecimal = bigDecimal.add(tChargingOrder.getOrderAmount()); + } + if (!chargingBillPayExports.isEmpty()){ + chargingBillPayExports.get(0).setTotal(bigDecimal+""); + } + if (byId.getSiteId()==0){ + chargingBillExport.setSiteName("全站"); + }else{ + List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(byId.getSiteId())).getData(); + if (data1!=null&&(!data1.isEmpty())){ + String name = data1.get(0).getName(); + chargingBillExport.setSiteName(name); + } + } chargingBillExport.setPaymentAmount(paymentAmount); chargingBillExport.setRefundAmount(refundAmount); @@ -332,9 +361,7 @@ // 导出 List<Map<String, Object>> sheetsList = new ArrayList<>(); - AtomicInteger atomicInteger = new AtomicInteger(); - - for (int i1 = 0; i1 < 3; i1++) { + for (int i1 = 1; i1 <= 3; i1++) { String sheetName=""; switch (i1){ case 1: diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index ac294ce..7785418 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -92,7 +92,8 @@ private TokenService tokenService; @Autowired private TOrderEvaluateService orderEvaluateService; - + @Autowired + private TGrantVipService tGrantVipService; @Resource private WxPaymentClient wxPaymentClient; @@ -133,6 +134,15 @@ @Resource private TOrderInvoiceService invoiceService; + /** + * 远程调用 增加管理后台赠送会员记录 + * @return + */ + @ResponseBody + @PostMapping(value = "/management/give/vip") + public R managementGiveVip(@RequestBody TGrantVip grantVip) { + return R.ok(tGrantVipService.save(grantVip)); + } /** * 远程调用根据枪id 查询最新的订单id 用户后台结束充电 @@ -790,16 +800,22 @@ List<UploadRealTimeMonitoringData> data1 = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery).getData(); List<ChargingOrderAndUploadRealTimeMonitoringDataDto> dtos = new ArrayList<>(); + Map<String,ChargingOrderVO> map = new HashMap<>(); for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data1) { ChargingOrderAndUploadRealTimeMonitoringDataDto dataDto = new ChargingOrderAndUploadRealTimeMonitoringDataDto(); BeanUtils.copyProperties(uploadRealTimeMonitoringData,dataDto); ChargingOrderQuery dto = new ChargingOrderQuery(); + dto.setCode(uploadRealTimeMonitoringData.getTransaction_serial_number()); TCharingOrderVO vo = chargingOrderService.chargingOrder(dto); - ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); - if (chargingOrderVO!=null) { - BeanUtils.copyProperties(chargingOrderVO, dataDto); + if (!vo.getList().getRecords().isEmpty()) { + ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); + if (chargingOrderVO != null) { + BeanUtils.copyProperties(chargingOrderVO, dataDto); + } + dtos.add(dataDto); + }else { + continue; } - dtos.add(dataDto); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java index 110fe78..9672dc8 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java @@ -65,6 +65,13 @@ private AppUserCarClient appUserCarClient; @Override public ChargingBillVO chargingBillList1(ChargingListQuery dto) { + if (dto.getState()!=null){ + if (dto.getState()==1){ + dto.setState(2); + }else { + dto.setState(1); + } + } ChargingBillVO chargingBillVO = new ChargingBillVO(); String startTime1 = null; String startTime2 = null; @@ -256,8 +263,8 @@ serviceCharge = serviceCharge.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getServiceCharge().multiply(BigDecimal.valueOf(0.006)) + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006)) .setScale(2,RoundingMode.HALF_DOWN)); } // 累加平台分佣 @@ -289,7 +296,7 @@ chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:orderAmount); chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge); - chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount); + chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount); chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity); chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount()) @@ -345,8 +352,6 @@ chargingBillVO.setCategory(""); chargingBillVO.setExportList(tChargingOrders); for (TChargingOrder tChargingOrder : tChargingOrders) { - - // 累加实收金额 支付金额减去退款金额 if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); @@ -369,8 +374,8 @@ serviceChargeTotal = serviceChargeTotal.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.006"))); + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getOrderAmount().multiply(new BigDecimal("0.006"))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -391,13 +396,13 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); - chargingBillVO.setPaymentAmount(paymentAmountTotal); - chargingBillVO.setOrderAmount(orderAmountTotal); - chargingBillVO.setElectrovalence(electrovalenceTotal); - chargingBillVO.setServiceCharge(serviceChargeTotal); + chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderCount(orderCount); - chargingBillVO.setCommissionAmount(commissionAmountTotal); - chargingBillVO.setSharingAmount(sharingAmountTotal); + chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setDiscount(discountTotal); @@ -407,6 +412,13 @@ } @Override public ChargingBillVO chargingBillList(ChargingListQuery dto) { + if (dto.getState()!=null){ + if (dto.getState()==1){ + dto.setState(2); + }else { + dto.setState(1); + } + } ChargingBillVO chargingBillVO = new ChargingBillVO(); String startTime1 = null; String startTime2 = null; @@ -488,8 +500,20 @@ BigDecimal chargingCapacity = new BigDecimal("0"); orderCount+=tChargingOrders.size(); chargingBillVO.setCategory(""); + chargingBillListVO.setOrderCount(tChargingOrders.size()); chargingBillVO.setExportList(tChargingOrders); + for (TChargingOrder tChargingOrder : tChargingOrders) { + if (tChargingOrder.getRechargePaymentType()!=null && tChargingOrder.getRechargePaymentType()==1){ + chargingBillListVO.setPayTypeName("微信商户"); + } + if (tChargingOrder.getRechargePaymentType()!=null && tChargingOrder.getRechargePaymentType()==2){ + if (StringUtils.hasLength(chargingBillListVO.getPayTypeName())){ + chargingBillListVO.setPayTypeName("微信商户+支付宝商户"); + }else{ + chargingBillListVO.setPayTypeName("支付宝商户"); + } + } List<Site> data = siteClient.getSiteByIds(Arrays.asList(tChargingOrder.getSiteId())).getData(); if (!data.isEmpty()){ chargingBillVO.setSiteName(data.get(0).getName()); @@ -600,8 +624,8 @@ serviceCharge = serviceCharge.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getServiceCharge().multiply(BigDecimal.valueOf(0.006)).setScale(2,RoundingMode.HALF_DOWN)); + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -624,8 +648,8 @@ chargingBillListVO.setOrderAmount(orderAmount); chargingBillListVO.setElectrovalence(electrovalence); chargingBillListVO.setServiceCharge(serviceCharge.setScale(2,RoundingMode.HALF_DOWN)); - chargingBillListVO.setCommissionAmount(commissionAmount); - chargingBillListVO.setSharingAmount(sharingAmount); + chargingBillListVO.setCommissionAmount(commissionAmount.setScale(2,RoundingMode.HALF_DOWN)); + chargingBillListVO.setSharingAmount(sharingAmount.setScale(2,RoundingMode.HALF_DOWN)); chargingBillListVO.setChargingCapacity(chargingCapacity); switch (chargingBillListVO.getType()){ case 1: @@ -715,9 +739,9 @@ serviceChargeTotal = serviceChargeTotal.add(tChargingOrder.getServiceCharge()); } // 累加平台手续费 - if (tChargingOrder.getServiceCharge()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.006")).setScale(2, RoundingMode.HALF_DOWN)); - commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getServiceCharge().multiply(new BigDecimal("0.006")).setScale(2, RoundingMode.HALF_DOWN)); + if (tChargingOrder.getOrderAmount()!=null){ + commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(new BigDecimal("0.006"))); + commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getOrderAmount().multiply(new BigDecimal("0.006"))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -739,14 +763,14 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); - chargingBillVO.setPaymentAmount(paymentAmountTotal); - chargingBillVO.setOrderAmount(orderAmountTotal); - chargingBillVO.setElectrovalence(electrovalenceTotal); - chargingBillVO.setServiceCharge(serviceChargeTotal); + chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderCount(orderCount); - chargingBillVO.setCommissionAmount(commissionAmountTotal); - chargingBillVO.setSharingAmount(sharingAmountTotal); - chargingBillVO.setDiscount(discountTotal); + chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setDiscount(discountTotal.setScale(2, RoundingMode.HALF_DOWN)); pageInfo.setRecords(list); chargingBillVO.setList(pageInfo); return chargingBillVO; 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 3e1118a..4ca0bdc 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 @@ -708,6 +708,9 @@ preChargeCheck1.setStartupSuccess(2); order.setStatus(3); order.setStartTime(LocalDateTime.now()); + TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); + chargingGun.setStatus(4); + chargingGunClient.updateChargingGunById(chargingGun); } redisService.setCacheObject("AQJC_" + order.getChargingGunId(), preChargeCheck1, 24L, TimeUnit.HOURS); this.updateById(order); @@ -1275,12 +1278,12 @@ List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); for (ChargingOrderListVO chargingOrderListVO : list) { chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity()); - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getOrderAmount()); + chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); BigDecimal bigDecimal = new BigDecimal("0.006"); - if (chargingOrderListVO.getServiceCharge()!=null){ - chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getServiceCharge().multiply(bigDecimal)); + if (chargingOrderListVO.getOrderAmount()!=null){ + chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getOrderAmount().multiply(bigDecimal)); } - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount().subtract(chargingOrderListVO.getResidualAmount())); + chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount()); chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); List<Integer> integers = new ArrayList<>(); integers.add(chargingOrderListVO.getSiteId()); @@ -1404,7 +1407,7 @@ for (ChargingOrderListVO chargingOrderListVO : list1) { if (chargingOrderListVO.getChargingCapacity()!=null)electronic = electronic.add(chargingOrderListVO.getElectricity()); - if (chargingOrderListVO.getPaymentAmount()!=null)paymentAmount = paymentAmount.add(chargingOrderListVO.getOrderAmount()); + if (chargingOrderListVO.getPaymentAmount()!=null)paymentAmount = paymentAmount.add(chargingOrderListVO.getPaymentAmount()); if (chargingOrderListVO.getElectrovalence()!=null)electrovalence = electrovalence.add(chargingOrderListVO.getElectrovalence()); if (chargingOrderListVO.getServiceCharge()!=null)serviceCharge = serviceCharge.add(chargingOrderListVO.getServiceCharge()); List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategyService.lambdaQuery() @@ -1494,8 +1497,8 @@ chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); BigDecimal bigDecimal = new BigDecimal("0.006"); - if (chargingOrder.getServiceCharge()!=null){ - chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getServiceCharge().multiply(bigDecimal)); + if (chargingOrder.getOrderAmount()!=null){ + chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getOrderAmount().multiply(bigDecimal)); } chargingOrderListInfoVO.setElectrovalence(chargingOrder.getElectrovalence()); chargingOrderListInfoVO.setServiceCharge(chargingOrder.getServiceCharge()); @@ -1663,6 +1666,8 @@ //获取订单的计费策略 List<AccountingStrategyDetailOrder> accountingStrategyDetailOrderList = accountingStrategyDetailOrderClient.getAllAccountingStrategyDetailOrder(chargingOrder.getId()).getData(); + + //开始处理计费明细数据和优惠数据 chargingOrderAccountingStrategyService.remove(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId())); for (int i = 0; i < accountingStrategyDetailOrderList.size(); i++) { Class<? extends TransactionRecordMessageVO> clazz = vo.getClass(); @@ -1705,22 +1710,23 @@ BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); BigDecimal serviceCharge = originalServicePrice; + BigDecimal vipDiscountAmount = BigDecimal.ZERO; //计算优惠金额 if(null != chargingOrder.getVipDiscount()){ + vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())).setScale(2, RoundingMode.DOWN); serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()).setScale(2, RoundingMode.DOWN); } chargingOrderAccountingStrategy.setChargingCapacity(sharp_peak_charge); chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc); chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge); chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice); + chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount); chargingOrderAccountingStrategy.setCreateTime(LocalDateTime.now()); chargingOrderAccountingStrategyService.save(chargingOrderAccountingStrategy); - BigDecimal periodElectricPrice = chargingOrderAccountingStrategy.getPeriodElectricPrice(); - BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodOriginalServicePrice(); - periodElectricPrice_total = periodElectricPrice_total.add(periodElectricPrice); - periodServicePrice_total = periodServicePrice_total.add(periodServicePrice); - total = total.add(periodElectricPrice.add(periodServicePrice)); + periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc); + periodServicePrice_total = periodServicePrice_total.add(originalServicePrice); + total = total.add(electrovalenc.add(originalServicePrice)); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { @@ -1743,21 +1749,19 @@ //折扣金额 BigDecimal discountAmount = BigDecimal.ZERO; if(null != chargingOrder.getVipDiscount()){ - //服务费折扣 - discountAmount = periodServicePrice_total.multiply((new BigDecimal(1).subtract(chargingOrder.getVipDiscount()))); - periodServicePrice_total = periodServicePrice_total.multiply(chargingOrder.getVipDiscount()); - TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); - if(null != appUser.getVipId()){ - //判断会员是否还有充电优惠次数 - GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); - getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); - getAppUserVipDetail.setVipId(appUser.getVipId()); - TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); - if(null != data && data.getChargeNum() > 0){ - data.setChargeNum(data.getChargeNum() - 1); - appUserVipDetailClient.updateAppUserVipDetail(data); - } + //判断会员是否还有充电优惠次数 + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); + getAppUserVipDetail.setVipId(appUser.getVipId()); + TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); + if(null != data && data.getChargeNum() > 0){ + data.setChargeNum(data.getChargeNum() - 1); + appUserVipDetailClient.updateAppUserVipDetail(data); + + //服务费折扣 + discountAmount = periodServicePrice_total.multiply((new BigDecimal(1).subtract(chargingOrder.getVipDiscount()))); + periodServicePrice_total = periodServicePrice_total.multiply(chargingOrder.getVipDiscount()); TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); BigDecimal maximumDeduction = vip.getMaximumDeduction(); @@ -1766,8 +1770,8 @@ discountAmount = maximumDeduction; } } - payAmount = payAmount.subtract(discountAmount); } + payAmount = payAmount.subtract(discountAmount); TChargingOrder order = new TChargingOrder(); order.setId(chargingOrder.getId()); @@ -1784,7 +1788,6 @@ order.setStatus(5); order.setOrderAmount(orderAmount); order.setVipDiscountAmount(discountAmount); - order.setServiceCharge(periodServicePrice_total); order.setElectrovalence(periodElectricPrice_total); order.setChargingCapacity(vo.getTotal_electricity()); order.setElectricity(vo.getTotal_electricity()); @@ -1805,10 +1808,12 @@ refundAmount = refundAmount.add(periodServicePrice_total); order.setCouponDiscountAmount(periodServicePrice_total); payAmount = payAmount.subtract(periodServicePrice_total); + periodServicePrice_total = BigDecimal.ZERO; }else{ refundAmount = refundAmount.add(couponDiscountAmount); order.setCouponDiscountAmount(couponDiscountAmount); payAmount = payAmount.subtract(couponDiscountAmount); + periodServicePrice_total = periodServicePrice_total.subtract(couponDiscountAmount); } appCoupon.setStatus(2); @@ -1830,10 +1835,12 @@ refundAmount = refundAmount.add(periodServicePrice_total); order.setCouponDiscountAmount(periodServicePrice_total); payAmount = payAmount.subtract(periodServicePrice_total); + periodServicePrice_total = BigDecimal.ZERO; }else{ refundAmount = refundAmount.add(divide); order.setCouponDiscountAmount(divide); payAmount = payAmount.subtract(divide); + periodServicePrice_total = periodServicePrice_total.subtract(divide); } appCoupon.setStatus(2); @@ -1845,11 +1852,27 @@ } } } + + order.setServiceCharge(periodServicePrice_total); order.setPaymentAmount(payAmount); order.setRefundAmount(refundAmount); order.setRefundStatus(1); this.updateById(order); chargingOrder = this.getById(order.getId()); + + //开始将优惠券优惠的金额添加到明细中 + BigDecimal couponDiscountAmount = order.getCouponDiscountAmount(); + if(null != couponDiscountAmount && couponDiscountAmount.compareTo(BigDecimal.ZERO) > 0){ + List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.list(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, order.getId())); + for (TChargingOrderAccountingStrategy chargingOrderAccountingStrategy : list) { + BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodServicePrice(); + BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(periodServicePrice_total, new MathContext(4, RoundingMode.HALF_EVEN))); + periodServicePrice = periodServicePrice.subtract(multiply); + chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice); + chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply); + } + chargingOrderAccountingStrategyService.updateBatchById(list); + } // 将枪状态重置为空闲 TChargingGun chargingGun = new TChargingGun(); @@ -2058,7 +2081,7 @@ model.setNotify_url("/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.setTotal(tChargingOrder.getRechargeAmount().multiply(new BigDecimal(100)).intValue()); amount.setCurrency("CNY"); model.setAmount(amount); R<String> orderR = wxPaymentClient.refundOrderR(model); @@ -2262,10 +2285,10 @@ } if (tChargingOrder.getRefundStatus()!=null &&tChargingOrder.getRefundStatus() == 2){ // 如果成功退款 那么减去退款金额 - paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount().subtract(tChargingOrder.getRefundAmount())); + paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); }else{ if (tChargingOrder.getPaymentAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); + paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); } } } @@ -2273,8 +2296,8 @@ commissionAmount = sharingAmount.multiply(new BigDecimal("0.006")); // 订单手续费 订单支付金额 - 退款金额*0.6% orderCommission = paymentAmount.multiply(new BigDecimal("0.006")); - tSettlementConfirm.setSharingAmount(sharingAmount); - tSettlementConfirm.setCommissionAmount(commissionAmount); + tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN)); + tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setElectrovalence(electrovalence); // 服务费=总服务费-三费收费-交易手续费-交易手续费-服务费会员抵扣-服务费优惠券抵扣 tSettlementConfirm.setServiceCharge(serviceCharge.subtract(commissionAmount).subtract(sharingAmount).subtract(orderCommission).subtract(vipDiscount).subtract(couponDiscount)); 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 05e1997..82c41ed 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 @@ -63,37 +63,37 @@ */ @Service public class TShoppingOrderServiceImpl extends ServiceImpl<TShoppingOrderMapper, TShoppingOrder> implements TShoppingOrderService { - + @Resource private TokenService tokenService; - + @Resource private GoodsClient goodsClient; - + @Resource private CouponClient couponClient; @Resource private AppUserClient appUserClient; - + @Resource private AppUserAddressClient appUserAddressClient; @Resource private AppCouponClient appCouponClient; - + @Resource private WxPaymentClient wxPaymentClient; - + @Resource private AliPaymentClient aliPaymentClient; - + @Resource private TShoppingOrderRefundService shoppingOrderRefundService; - + @Autowired public RedisTemplate redisTemplate; - - - + + + @Override public TActivityVO activityStatistics(TActivityStatisticsQuery dto) { @@ -117,6 +117,10 @@ BigDecimal grantVip = new BigDecimal("0"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (TActivityStatisticslVO tActivityStatisticslVO : list1) { + TAppUser data = appUserClient.getUserById(tActivityStatisticslVO.getAppUserId()).getData(); + if (data!=null){ + tActivityStatisticslVO.setPhone(data.getPhone()); + } // 判断享有了哪些类型 switch (tActivityStatisticslVO.getOrderType()){ case 1: @@ -187,6 +191,7 @@ } } for (TActivityStatisticslVO tActivityStatisticslVO : list) { + // 判断享有了哪些类型 switch (tActivityStatisticslVO.getOrderType()){ case 1: @@ -265,8 +270,8 @@ res.setGrantVip(grantVip); return res; } - - + + /** * 获取小程序商城购买订单列表 * @param query @@ -313,8 +318,8 @@ map.put("total", count); return map; } - - + + /** * 获取购买订单详情 * @param id @@ -364,8 +369,8 @@ } return info; } - - + + /** * 取消订单 * @param id @@ -386,10 +391,10 @@ if(shoppingOrder.getPaymentAmount().compareTo(bigDecimal) == 0 && shoppingOrder.getStatus() == 4){ return AjaxResult.error("订单已取消,不能重复操作"); } - + //退款金额 BigDecimal refundAmount = shoppingOrder.getPaymentAmount().subtract(bigDecimal); - + //先查询第三方订单状态订单是否退款 //支付方式(1=微信,2=支付宝) Integer paymentType = shoppingOrder.getPaymentType(); @@ -438,7 +443,7 @@ shoppingOrderRefund.setRefundRemark("全额退款"); shoppingOrderRefund.setRefundTotalAmount(refundAmount.add(bigDecimal)); shoppingOrderRefund.setPayAmount(shoppingOrder.getPaymentAmount()); - + shoppingOrder.setCancellationTime(LocalDateTime.now()); shoppingOrder.setCancellationId(shoppingOrder.getAppUserId()); if(1 == paymentType){ @@ -474,8 +479,8 @@ } return AjaxResult.success(); } - - + + /** * 商城订单取消订单微信退款处理 * @param out_refund_no 退款单号 @@ -500,7 +505,7 @@ shoppingOrder.setRefundStatus(2); shoppingOrder.setRefundTime(one.getRefundTime()); this.updateById(shoppingOrder); - + //商品 if(shoppingOrder.getOrderType() == 1){ //redis锁 和支付使用同一个锁 @@ -541,7 +546,7 @@ } return AjaxResult.success(); } - + /** * 获取未开票的订单列表 * @param query diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java index a1e684f..37f8bac 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java @@ -6,7 +6,9 @@ import com.ruoyi.chargingPile.api.feignClient.SiteClient; import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.order.api.model.TChargingBill; +import com.ruoyi.order.api.model.TChargingOrder; import com.ruoyi.order.service.TChargingBillService; +import com.ruoyi.order.service.TChargingOrderService; import org.apache.logging.log4j.core.util.UuidUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -34,6 +36,8 @@ private TChargingBillService chargingBillService; @Resource private SiteClient siteClient; + @Resource + private TChargingOrderService chargingOrderService; public static void main(String[] args) { LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). @@ -48,7 +52,7 @@ // 每天凌晨12点执行的定时任务 -@Scheduled(cron = "0 0 12 1 * ?") +@Scheduled(cron = "0 0 0 * * ?") //@Scheduled(fixedRate = 60000) public void taskMonth() { try { @@ -104,6 +108,11 @@ .collect(Collectors.joining()); // 将其连接成一个字符串 tChargingBill2.setCode("JSD"+string+randomDigits2+(i+1) ); tChargingBill2.setType(2); + List<TChargingOrder> list = chargingOrderService.lambdaQuery() + .eq(TChargingOrder::getSiteId, collect.get(i)).list(); + if (list.isEmpty()){ + continue; + } tChargingBill2.setSiteId(collect.get(i)); tChargingBill2.setBillTime(LocalDateTime.now()); tChargingBill2.setBillType(1); @@ -134,7 +143,7 @@ } // 每天晚上23:59:59执行的定时任务 - @Scheduled(cron = "0 0 23 1 * ?") + @Scheduled(cron = "0 0 23 * * ?") public void taskLastDay() { try { // 获取上个月的开始和结束日期 diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index 1b22fd9..769ad04 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -121,7 +121,6 @@ title, `status`, order_amount, - recharge_amount, payment_amount , create_time, end_time, diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml index d0401f3..ae289b4 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml @@ -49,6 +49,7 @@ t9.vip_discount_amount as vipDiscountAmount, t9.payment_amount as paymentAmount, t9.create_time as createTime, + t9.app_user_id as appUserId, 1 as orderType from t_charging_order t9 where t9.id = 0 limit 1 @@ -60,6 +61,7 @@ t1.vip_discount_amount as vipDiscountAmount, t1.payment_amount as paymentAmount, t1.create_time as createTime, + t1.app_user_id as appUserId, 1 as orderType from t_charging_order t1 where 1 = 1 @@ -67,10 +69,13 @@ and t1.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="req.type != null and req.type != '' and req.type == 1"> - and t1.coupon_discount_amount IS NOT NULL and t1.coupon_discount_amount != 0 + and t1.coupon_discount_amount > 0 </if> <if test="req.type != null and req.type != '' and req.type == 2"> - and t1.vip_discount_amount IS NOT NULL and t1.vip_discount_amount != 0 + and t1.vip_discount_amount > 0 + </if> + <if test="req.type == null "> + and (t1.vip_discount_amount > 0 or t1.coupon_discount_amount > 0) </if> <if test="null != req.userIds and req.userIds.size()>0" > and t1.app_user_id in @@ -95,11 +100,12 @@ <if test="req.orderType == null or req.orderType == 2"> <if test="req.type == null or req.type == 1 or req.type == 2"> union all - select t2.code ,t2.order_amount as orderAmount, + select t2.code ,t2.order_amount as paymentAmount, t2.coupon_discount_amount as couponDiscountAmount, t2.vip_discount_amount as vipDiscountAmount, - t2.payment_amount as paymentAmount, + t2.payment_amount as orderAmount, t2.create_time as createTime, + t2.app_user_id as appUserId, 2 as orderType from t_shopping_order t2 where 1 = 1 @@ -136,6 +142,7 @@ t3.discount_amount as vipDiscountAmount, t3.payment_amount as paymentAmount, t3.create_time as createTime, + t3.app_user_id as appUserId, 3 as orderType from t_vip_order t3 where 1 = 1 @@ -144,7 +151,7 @@ and t3.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="req.type == null "> - and t3.discount_amount IS NOT NULL and t3.discount_amount != 0 + and t3.discount_amount > 0 </if> <if test="null != req.userIds and req.userIds.size()>0" > and t3.app_user_id in @@ -167,6 +174,7 @@ t4.discount_amount as vipDiscountAmount, t4.payment_amount as paymentAmount, t4.create_time as createTime, + t4.app_user_id as appUserId, 4 as orderType from t_vip_order t4 where 1 = 1 @@ -175,7 +183,7 @@ and t4.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="req.type == null "> - and t4.discount_amount IS NOT NULL and t4.discount_amount != 0 + and t4.discount_amount > 0 </if> <if test="null != req.userIds and req.userIds.size()>0" > and t4.app_user_id in @@ -198,6 +206,7 @@ 0 as vipDiscountAmount, 0 as paymentAmount, t5.create_time as createTime, + t5.app_user_id as appUserId, 4 as orderType from t_grant_vip t5 where 1 = 1 -- Gitblit v1.7.1