ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserCar.java
@@ -33,6 +33,8 @@ @TableId("id") private Long id; @TableField(exist = false) private String id_; @TableField(exist = false) private String uid; @ApiModelProperty(value = "app用户id") ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserSign.java
@@ -54,6 +54,8 @@ @TableField("create_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createTime; @TableField(exist = false) private Integer continueDays; } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java
@@ -91,6 +91,9 @@ @TableField(exist = false) private Integer type; @TableField(exist = false) private TVip vip; } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TVip.java
New file @@ -0,0 +1,156 @@ package com.ruoyi.account.api.model; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.web.domain.BasePojo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; /** * <p> * * </p> * * @author 无关风月 * @since 2024-08-06 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("t_vip") @ApiModel(value="TVip对象", description="") public class TVip extends BasePojo { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") @TableId(value = "id", type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "会员名称") @TableField("name") private String name; @ApiModelProperty(value = "前端是否显示(0=否,1=是)") @TableField("reveal") private Integer reveal; @ApiModelProperty(value = "月卡价格") @TableField("monthly_card") private BigDecimal monthlyCard; @ApiModelProperty(value = "月卡显示(0=否,1=是)") @TableField("monthly_card_reveal") private Integer monthlyCardReveal; @ApiModelProperty(value = "月卡折扣") @TableField("monthly_card_discount") private BigDecimal monthlyCardDiscount; @ApiModelProperty(value = "月卡折扣开始时间") @TableField("monthly_card_discount_start") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime monthlyCardDiscountStart; @ApiModelProperty(value = "月卡折扣结束时间") @TableField("monthly_card_discount_end") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime monthlyCardDiscountEnd; @ApiModelProperty(value = "月卡折扣显示(0=否,1=是)") @TableField("monthly_card_discount_reveal") private Integer monthlyCardDiscountReveal; @ApiModelProperty(value = "季卡价格") @TableField("season_card") private BigDecimal seasonCard; @ApiModelProperty(value = "季卡显示(0=否,1=是)") @TableField("season_card_reveal") private Integer seasonCardReveal; @ApiModelProperty(value = "季卡折扣") @TableField("season_card_discount") private BigDecimal seasonCardDiscount; @ApiModelProperty(value = "季卡折扣开始时间") @TableField("season_card_discount_start") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime seasonCardDiscountStart; @ApiModelProperty(value = "季卡折扣结束时间") @TableField("season_card_discount_end") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime seasonCardDiscountEnd; @ApiModelProperty(value = "季卡折扣显示(0=否,1=是)") @TableField("season_card_discount_reveal") private Integer seasonCardDiscountReveal; @ApiModelProperty(value = "年卡价格") @TableField("annual_card") private BigDecimal annualCard; @ApiModelProperty(value = "年卡显示(0=否,1=是)") @TableField("annual_card_reveal") private Integer annualCardReveal; @ApiModelProperty(value = "年卡折扣") @TableField("annual_card_discount") private BigDecimal annualCardDiscount; @ApiModelProperty(value = "年卡折扣开始时间") @TableField("annual_card_discount_start") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime annualCardDiscountStart; @ApiModelProperty(value = "年卡折扣结束时间") @TableField("annual_card_discount_end") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime annualCardDiscountEnd; @ApiModelProperty(value = "年卡折扣显示(0=否,1=是)") @TableField("annual_card_discount_reveal") private Integer annualCardDiscountReveal; @ApiModelProperty(value = "折扣次数") @TableField("discount_times") private Integer discountTimes; @ApiModelProperty(value = "最高抵扣金额") @TableField("maximum_deduction") private BigDecimal maximumDeduction; @ApiModelProperty(value = "抵扣类型(1=服务费)") @TableField("deduction_type") private Integer deductionType; @ApiModelProperty(value = "优惠券[{\"id\":1,\"number\":1}]") @TableField("coupon") private String coupon; @ApiModelProperty(value = "双倍积分开关(0=否,1=是)") @TableField("double_integration") private Integer doubleIntegration; @ApiModelProperty(value = "商城专享价开关(0=否,1=是)") @TableField("mall_exclusive_price") private Integer mallExclusivePrice; @ApiModelProperty(value = "内部会员折扣") @TableField("discount") private BigDecimal discount; @ApiModelProperty(value = "添加的会员类型 1常规 2内部") @TableField("type") private Integer type; @ApiModelProperty(value = "优惠券名称和张数 后台列表展示使用") @TableField(exist = false) private String couponName; } ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java
@@ -58,7 +58,7 @@ } @Override public void updateChargingPileStatus(String code, Integer status) { public void updateChargingPileStatus(String pile_code, String gun_code, Integer status) { log.error("修改充电桩状态失败:" + throwable.getMessage()); } ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java
@@ -57,5 +57,5 @@ * @param status */ @PostMapping("/t-charging-pile/updateChargingPileStatus") void updateChargingPileStatus(@RequestParam("code") String code, @RequestParam("status") Integer status); void updateChargingPileStatus(@RequestParam("pile_code") String pile_code, @RequestParam("gun_code") String gun_code, @RequestParam("status") Integer status); } ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java
@@ -37,12 +37,13 @@ @TableField("app_user_id") private Long appUserId; @ApiModelProperty(value = "停车场名称") @TableField("name") private String name; @ApiModelProperty(value = "车牌号") @TableField("license_plate") private String licensePlate; @TableField(exist = false) private String name; @TableField(exist = false) private String uid; ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java
@@ -42,5 +42,5 @@ @ApiModelProperty(value = "上次选择车辆品牌") private String vehicleBrand; @ApiModelProperty(value = "上次选择车辆id") private Long id; private String id; } ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/UploadRealTimeMonitoringDataFallbackFactory.java
@@ -47,6 +47,11 @@ public R<UploadRealTimeMonitoringPageData> getAll(MongoChargingOrderQuery mongoChargingOrderQuery) { return null; } @Override public R delete(String id) { return null; } }; } } ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/UploadRealTimeMonitoringDataClient.java
@@ -46,4 +46,7 @@ @PostMapping("/uploadRealTimeMonitoringData/getAll") R<UploadRealTimeMonitoringPageData> getAll(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery); @PostMapping("/uploadRealTimeMonitoringData/delete") R delete(@RequestParam("id") String id); } ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/model/BaseModel.java
@@ -1,5 +1,6 @@ package com.ruoyi.integration.api.model; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @@ -10,7 +11,8 @@ */ @Data public class BaseModel { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date last_time = new Date(); @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date create_time = new Date(); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
@@ -158,6 +158,11 @@ public void endChargeBillingCharge(TransactionRecordMessageVO vo) { log.error("停止充电返回账单后计算费用处理失败:" + throwable.getMessage()); } @Override public R<List<TChargingOrder>> getChargingOrder(TChargingOrderVo order) { return R.fail("获取充电订单数据失败:" + throwable.getMessage()); } }; } } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
@@ -206,4 +206,12 @@ */ @PostMapping("/t-charging-order/endChargeBillingCharge") void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo); /** * 获取充电订单数据 * @param order * @return */ @PostMapping("/t-charging-order/getChargingOrder") R<List<TChargingOrder>> getChargingOrder(@RequestBody TChargingOrderVo order); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/TChargingOrderAccountingStrategy.java
@@ -105,5 +105,4 @@ } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountingStrategyDetailOrderVo.java
New file @@ -0,0 +1,47 @@ package com.ruoyi.order.api.vo; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; /** * @author zhibing.pu * @Date 2024/9/3 14:00 */ @Data public class AccountingStrategyDetailOrderVo { @ApiModelProperty(value = "主键") private Integer id; @ApiModelProperty(value = "策略id") private Integer accountingStrategyId; @ApiModelProperty(value = "阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段)") private Integer type; @ApiModelProperty(value = "开始时间") private String startTime; @ApiModelProperty(value = "结束时间") private String endTime; @ApiModelProperty(value = "电价") private BigDecimal electrovalence; @ApiModelProperty(value = "服务费") private BigDecimal serviceCharge; @ApiModelProperty(value = "原价服务费") private BigDecimal costServiceCharge; @ApiModelProperty(value = "充电订单id") private Long chargingOrderId; private Long start; private Long end; private BigDecimal chargingCapacity; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TChargingOrderVo.java
New file @@ -0,0 +1,15 @@ package com.ruoyi.order.api.vo; import com.ruoyi.order.api.model.TChargingOrder; import lombok.Data; import java.util.List; /** * @author zhibing.pu * @Date 2024/10/29 13:35 */ @Data public class TChargingOrderVo extends TChargingOrder { private List<Integer> statusList; } ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserClient.java
@@ -7,10 +7,7 @@ import com.ruoyi.system.api.factory.SysUserFallbackFactory; import com.ruoyi.system.api.model.*; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; 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.*; import javax.management.relation.Role; import java.util.List; @@ -22,7 +19,7 @@ R<List<CompanyUserListVo>> getSysUserFromCompanyId(@RequestBody CompanySysUserReq companySysUserReq); @PostMapping("/user/getSysUser") R<SysUser> getSysUser(Long userId); R<SysUser> getSysUser(@RequestParam("userId")Long userId); @PostMapping("/user/updateSysUser") R<Boolean> updateSysUser(@RequestBody SysUser sysUser); ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/MD5Util.java
@@ -52,27 +52,20 @@ public static String getMD5(String str) { if (StringUtils.isNotEmpty(str)) { try { // 创建MD5加密实例 MessageDigest md = MessageDigest.getInstance("MD5"); md.update(str.getBytes()); byte b[] = md.digest(); int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) i += 256; if (i < 16) buf.append("0"); buf.append(Integer.toHexString(i)); // 执行加密操作 byte[] messageDigest = md.digest(str.getBytes()); // 将得到的散列值转换为十六进制 StringBuilder sb = new StringBuilder(); for (byte b : messageDigest) { sb.append(String.format("%02x", b)); } //32位加密(小写) return buf.toString(); //32位加密(大写) //return buf.toString().toUpperCase(); // 16位的加密(小写) //return buf.toString().substring(8, 24); // 16位的加密(大写) //return buf.toString().substring(8, 24).toUpperCase(); // 返回MD5散列值 return sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java
@@ -354,7 +354,7 @@ } @PostMapping("/getSysUser") public R<SysUser> getSysUser(@RequestBody Long userId) { public R<SysUser> getSysUser(@RequestParam("userId") Long userId) { try { SysUser sysUser = userService.selectUserById(userId); return R.ok(sysUser); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -122,13 +122,13 @@ // 没有充电订单 展示最新添加的车辆 data.setLicensePlate(cars.get(0).getLicensePlate()); data.setVehicleBrand(cars.get(0).getVehicleBrand()); data.setId(cars.get(0).getId()); data.setId(cars.get(0).getId().toString()); }else{ for (TAppUserCar car : cars) { if (car.getId().equals(data1)){ data.setLicensePlate(car.getLicensePlate()); data.setVehicleBrand(car.getVehicleBrand()); data.setId(car.getId()); data.setId(car.getId().toString()); } } } @@ -164,6 +164,7 @@ public R<List<TAppUserCar>> carList() { List<TAppUserCar> appUserId = appUserCarService.list(new QueryWrapper<TAppUserCar>() .eq("app_user_id",tokenService.getLoginUserApplet().getUserId())); appUserId.forEach(s->s.setId_(s.getId().toString())); return R.ok(appUserId); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -41,6 +41,7 @@ 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.domain.TVip; import com.ruoyi.other.api.dto.UnitListQueryDto; import com.ruoyi.other.api.feignClient.IntegralRuleClient; import com.ruoyi.other.api.feignClient.OtherClient; @@ -710,7 +711,7 @@ @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) @GetMapping(value = "/user/coupon/getById") @PostMapping(value = "/user/coupon/getById") public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { TAppCoupon appCoupon = appCouponService.getById(id); appCoupon.setUid(id.toString()); @@ -741,13 +742,13 @@ TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData(); switch (giveVipDto.getType()){ case 1: bigDecimal = bigDecimal.add(info.getMonthlyCard()); bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard()); break; case 2: bigDecimal = bigDecimal.add(info.getSeasonCard()); bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard()); break; case 3: bigDecimal = bigDecimal.add(info.getAnnualCard()); bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard()); break; } //增加vipDetail @@ -969,6 +970,10 @@ .eq(TAppUserSign::getAppUserId, userId) .orderByDesc(TAppUserSign::getSignDay) .list(); for (TAppUserSign signRecord : signRecords) { int i = signDayUtil.calculateContinuousSignDays1(signRecord.getAppUserId(), signRecord.getSignDay()); signRecord.setContinueDays(i); } return R.ok(signRecords); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserVipDetailController.java
@@ -1,15 +1,16 @@ package com.ruoyi.account.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.account.api.dto.SendCouponDto; import com.ruoyi.account.api.model.TAppUserVipDetail; import com.ruoyi.account.api.model.TVip; import com.ruoyi.account.api.vo.GetAppUserVipDetail; import com.ruoyi.account.service.TAppUserVipDetailService; import com.ruoyi.account.util.VipInfoDto; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.TCoupon; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.dto.VipCouponDto; import com.ruoyi.other.api.feignClient.OtherClient; import com.ruoyi.other.api.feignClient.VipClient; @@ -62,9 +63,11 @@ for (TAppUserVipDetail tAppUserVipDetail : list) { if(null != tAppUserVipDetail.getVipId()){ TVip data = vipClient.getInfo1(tAppUserVipDetail.getVipId()).getData(); tAppUserVipDetail.setVipName(data.getName()); tAppUserVipDetail.setType(data.getType()); TVip tVip = JSONObject.parseObject(tAppUserVipDetail.getVipJson(), TVip.class); // TVip data = vipClient.getInfo1(tAppUserVipDetail.getVipId()).getData(); tAppUserVipDetail.setVipName(tVip.getName()); tAppUserVipDetail.setType(tVip.getType()); tAppUserVipDetail.setVip(tVip); } } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/SignDayUtil.java
@@ -4,7 +4,9 @@ import cn.hutool.core.date.DateUtil; import com.ruoyi.account.api.model.TAppUserSign; import com.ruoyi.account.service.TAppUserSignService; import org.springframework.cglib.core.Local; import org.springframework.stereotype.Component; import sun.rmi.server.LoaderHandler; import javax.annotation.Resource; import java.time.LocalDate; @@ -48,6 +50,31 @@ return calculateMaxContinuousSignDays(signDays); } public int calculateContinuousSignDays1(Long userId, LocalDate date) { DateTime startOfMonth = DateUtil.beginOfMonth(new Date()); // DateTime endOfMonth = DateUtil.endOfMonth(new Date()); // 获取用户的所有签到记录 List<TAppUserSign> signRecords = signService.lambdaQuery() .between(TAppUserSign::getSignDay, startOfMonth, date) .eq(TAppUserSign::getAppUserId, userId) .orderByDesc(TAppUserSign::getSignDay) .list(); // 如果没有签到记录,则返回0 if (signRecords.isEmpty()) { return 0; } // 将签到日期转换为 LocalDate 列表,并按照日期排序 List<LocalDate> signDays = signRecords.stream() .map(TAppUserSign::getSignDay) .sorted() .collect(Collectors.toList()); // 计算连续签到的最大天数 return calculateMaxContinuousSignDays(signDays); } /** * 根据签到日期列表计算连续签到的最大天数 * @param signDays 签到日期列表 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -123,8 +123,8 @@ SiteInfoVO siteInfoVO = new SiteInfoVO(); 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()); Site byId = siteService.getById(chargingGun.getSiteId()); TAccountingStrategy byId1 = accountingStrategyService.getById(chargingGun.getAccountingStrategyId()); List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list(); list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); for (TAccountingStrategyDetail tAccountingStrategyDetail : list) { ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java
@@ -327,7 +327,7 @@ @PostMapping(value = "/auth/pageList") public AjaxResult<PageInfo<TAccountingStrategyVO>> authPageList(@RequestBody TAccountingStrategyQuery query) { return AjaxResult.ok(accountingStrategyService.pageList(query)); return AjaxResult.ok(accountingStrategyService.pageList1(query)); } @@ -361,9 +361,12 @@ byId.setSiteId(one.getSiteId()); //将site表对应的模板id修改为新的这个 Site byId1 = siteService.getById(one.getSiteId()); if (byId1!=null) { byId1.setAccountingStrategyId(byId.getId()); siteService.updateById(byId1); } accountingStrategyService.removeById(one.getId()); } //硬件 List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, byId.getSiteId()).list(); for (TChargingPile tChargingPile : list) { ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
@@ -390,7 +390,6 @@ TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData(); for (TChargingOrder chargingOrder : data.getList()) { SettlementExportVO settlementExportVO = new SettlementExportVO(); BeanUtils.copyProperties(data, settlementExportVO); List<Site> data3 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); if (data3!=null && (!data3.isEmpty())){ @@ -484,7 +483,8 @@ settlementExportVO.setCreateTime1(createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); settlementExportVO.setStartTime1(startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); settlementExportVO.setEndTime1(endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); switch (settlementExportVO.getStatus()){ if (chargingOrder.getStatus()!=null){ switch (chargingOrder.getStatus()){ case 0: settlementExportVO.setStatusName("未知"); break; @@ -504,6 +504,7 @@ settlementExportVO.setStatusName("已结束"); break; } } settlementExportVO.setOrderTypeName("充电订单"); settlementExportVO.setChargingType("单桩双充"); @@ -590,7 +591,6 @@ excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); excelWriter.fill(new FillWrapper("data2", chargingBillVOS), fillConfig, writeSheet2); excelWriter.fill(new FillWrapper("data3", data.getList()), fillConfig, writeSheet3); excelWriter.fill(new FillWrapper("data4", data.getList()), fillConfig, writeSheet3); excelWriter.finish(); } catch (Exception e) { return R.fail("excel导出失败!"); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -27,6 +27,9 @@ import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.order.api.feignClient.ChargingOrderClient; import com.ruoyi.order.api.model.TChargingOrder; import com.ruoyi.order.api.vo.TChargingOrderVo; import com.ruoyi.other.api.domain.TVip; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -41,9 +44,8 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.*; import java.util.stream.Collectors; /** * <p> @@ -66,6 +68,9 @@ @Resource private TFaultMessageService faultMessageService; @Resource private ChargingOrderClient chargingOrderClient; @Autowired @@ -206,7 +211,7 @@ */ @ResponseBody @PostMapping("/getChargingPileById/{id}") public R<TChargingPile> getChargingPileById(@PathVariable Integer id){ public R<TChargingPile> getChargingPileById(@PathVariable("id") Integer id){ TChargingPile chargingPile = chargingPileService.getById(id); return R.ok(chargingPile); } @@ -214,49 +219,94 @@ /** * 更新充电桩状态 * @param code * @param status */ @ResponseBody @PostMapping("/updateChargingPileStatus") public void updateChargingPileStatus(@RequestParam("code") String code, @RequestParam("status") Integer status){ TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>() .eq(TChargingPile::getCode, code).eq(TChargingPile::getDelFlag, 0)); if(null != chargingPile){ //充电桩正常,返回异常,处理充电桩状态和添加故障记录 if(chargingPile.getStatus() == 1 && 1 == status){ TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) .eq(TFaultMessage::getStatus, 2).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); if(null == faultMessage){ faultMessage = new TFaultMessage(); public void updateChargingPileStatus(@RequestParam("pile_code") String pile_code, @RequestParam("gun_code") String gun_code, @RequestParam("status") Integer status){ Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online"); Long time = (Long) charging_pile_online.get(pile_code + gun_code); //小于30秒才处理数据,防止频繁查询数据 if(null != time && (System.currentTimeMillis() - time) < 30000){ return; } TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0)); if(null != tChargingGun){ TChargingPile chargingPile = chargingPileService.getById(tChargingGun.getChargingPileId()); //枪处于离线或者故障,返回状态为正常,则修改其状态 if(0 == status && tChargingGun.getStatus() != 2){ TChargingGun tChargingGun1 = new TChargingGun(); tChargingGun1.setId(tChargingGun.getId()); tChargingGun1.setStatus(2); chargingGunService.updateById(tChargingGun1); if(chargingPile.getStatus() != 1){ TChargingPile chargingPile1 = new TChargingPile(); chargingPile1.setId(chargingPile.getId()); chargingPile1.setStatus(1); chargingPileService.updateById(chargingPile1); } List<TFaultMessage> list = faultMessageService.list(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingGunId, tChargingGun.getId()) .isNull(TFaultMessage::getEndTime)); if(!list.isEmpty()){ list.forEach(s->s.setEndTime(LocalDateTime.now())); faultMessageService.updateBatchById(list); } } //枪处于正常,返回状态为故障,则修改其状态 if(1 == status && tChargingGun.getStatus() != 1 && tChargingGun.getStatus() != 7){ TChargingGun tChargingGun1 = new TChargingGun(); tChargingGun1.setId(tChargingGun.getId()); tChargingGun1.setStatus(7); chargingGunService.updateById(tChargingGun1); //桩处于正常,桩所属的枪都处于非正常,修改桩状态为异常 List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0)); int size = list.stream().filter(s -> s.getStatus() == 1 || s.getStatus() == 7).collect(Collectors.toList()).size(); if(chargingPile.getStatus() == 1 && list.size() == size){ TChargingPile chargingPile1 = new TChargingPile(); chargingPile1.setId(chargingPile.getId()); chargingPile1.setStatus(3); chargingPileService.updateById(chargingPile1); } TFaultMessage faultMessage = new TFaultMessage(); faultMessage.setSiteId(chargingPile.getSiteId()); faultMessage.setChargingPileId(chargingPile.getId()); faultMessage.setChargingGunId(tChargingGun.getId()); faultMessage.setStatus(2); 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); } chargingPile.setStatus(0 == status ? 1 : 3); chargingPileService.updateById(chargingPile); if(1 != status){ charging_pile_online.put(tChargingGun.getFullNumber(), System.currentTimeMillis()); redisService.setCacheMap("charging_gun_online", charging_pile_online); } if(0 == status){ Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_pile_online"); charging_pile_online.put(code, System.currentTimeMillis()); redisService.setCacheMap("charging_pile_online", charging_pile_online); if(2 == status){ TChargingOrderVo order = new TChargingOrderVo(); order.setChargingPileId(tChargingGun.getChargingPileId()); order.setChargingGunId(tChargingGun.getId()); order.setStatusList(Arrays.asList(1, 2, 3, 4, 5)); List<TChargingOrder> orders = chargingOrderClient.getChargingOrder(order).getData(); if(orders.size() > 0){ TChargingOrder chargingOrder = orders.get(0); TChargingGun tChargingGun1 = new TChargingGun(); if(Arrays.asList(1, 2).contains(chargingOrder.getStatus())){ tChargingGun1.setStatus(3); } if(Arrays.asList(3).contains(chargingOrder.getStatus())){ tChargingGun1.setStatus(4); } if(Arrays.asList(4).contains(chargingOrder.getStatus()) && chargingOrder.getEndMode() == 2){ tChargingGun1.setStatus(5); } tChargingGun1.setId(tChargingGun.getId()); chargingGunService.updateById(tChargingGun1); } } } } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
@@ -70,7 +70,6 @@ .page(Page.of(query.getPageCurr(), query.getPageSize())); for (TParkingRecord record : page.getRecords()) { record.setName(parkingLotService.getById(record.getParkingLotId()).getName()); record.setUid(record.getId().toString()); } return R.ok(page); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TRepairController.java
@@ -1,6 +1,8 @@ package com.ruoyi.chargingPile.controller; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.chargingPile.api.model.TFaultMessage; import com.ruoyi.chargingPile.api.model.TRepair; import com.ruoyi.chargingPile.service.TRepairService; @@ -38,8 +40,8 @@ private TRepairService repairService; @Resource private TokenService tokenService; @Autowired private SysUserClient userClient; @Resource private AppUserClient appUserClient; /** * 添加故障报修管理 @@ -50,9 +52,9 @@ public AjaxResult<String> add(@Validated @RequestBody TRepair dto) { Long userId = tokenService.getLoginUserApplet().getUserId(); // 查询报修人员信息 SysUser user = userClient.getSysUser(userId).getData(); TAppUser user = appUserClient.getUserById(userId).getData(); if(Objects.nonNull(user)){ dto.setRepairman(user.getUserName()); dto.setRepairman(user.getName()); } repairService.add(dto); return AjaxResult.success(); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java
@@ -113,7 +113,7 @@ TVehicleRamp vehicleRamp = vehicleRampService.getById(dto.getId()); TParkingLot parkingLot = parkingLotService.getById(vehicleRamp.getParkingLotId()); SwitchwayGateReq req = new SwitchwayGateReq(); req.setAction(vehicleRamp.getAction()); req.setAction(dto.getAction()); req.setChannel(vehicleRamp.getCarportNum()); req.setAppkey(parkingLot.getAppKey()); req.setSecretkey(parkingLot.getSecretKey()); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TAccountingStrategyMapper.java
@@ -28,6 +28,7 @@ * @return */ List<TAccountingStrategyVO> pageList(@Param("query") TAccountingStrategyQuery query, @Param("pageInfo")PageInfo<TAccountingStrategyVO> pageInfo); List<TAccountingStrategyVO> pageList1(@Param("query") TAccountingStrategyQuery query, @Param("pageInfo")PageInfo<TAccountingStrategyVO> pageInfo); /** ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TAccountingStrategyService.java
@@ -24,6 +24,7 @@ * @return */ PageInfo<TAccountingStrategyVO> pageList(TAccountingStrategyQuery query); PageInfo<TAccountingStrategyVO> pageList1(TAccountingStrategyQuery query); /** * 获取平台添加的计费策略 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/PartnerServiceImpl.java
@@ -375,7 +375,7 @@ child.put("selected", collect.contains(siteMenu.getMenuId())); list2.add(child); } menu.put("selected", list2.size() > 0 ? true : false); menu.put("selected", collect.contains(tSiteMenu.getMenuId())); menu.put("child", list2); list1.add(menu); } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java
@@ -300,7 +300,9 @@ TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); if(Objects.nonNull(vip) && vip.getType() == 2){ list.forEach(item -> { if(Objects.nonNull(vip.getDiscount())){ item.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); } }); } } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java
@@ -64,6 +64,28 @@ pageInfo.setRecords(list); return pageInfo; } @Override public PageInfo<TAccountingStrategyVO> pageList1(TAccountingStrategyQuery query) { PageInfo<TAccountingStrategyVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<TAccountingStrategyVO> list = this.baseMapper.pageList1(query,pageInfo); List<Integer> parentIds = list.stream().map(TAccountingStrategyVO::getId).collect(Collectors.toList()); for (TAccountingStrategyVO tAccountingStrategyVO : list) { SysUser data = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); tAccountingStrategyVO.setUserName(data.getNickName()); if (tAccountingStrategyVO.getFirstUserId()!=null){ SysUser first = sysUserClient.getSysUser(tAccountingStrategyVO.getFirstUserId()).getData(); tAccountingStrategyVO.setFirstUserName(first==null?null:first.getNickName()); } if (tAccountingStrategyVO.getTwoUserId()!=null){ SysUser two = sysUserClient.getSysUser(tAccountingStrategyVO.getTwoUserId()).getData(); tAccountingStrategyVO.setTwoUserName(two==null?null:two.getNickName()); } } pageInfo.setRecords(list); return pageInfo; } /** ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -170,19 +170,19 @@ return AjaxResult.error("设备编号已存在"); } //调用华为Iot创建设备 AddDevice addDevice = new AddDevice(); addDevice.setProductId("66da68d21837002b28b34ec0"); addDevice.setNodeId(chargingPile.getCode()); addDevice.setDeviceName(chargingPile.getName()); addDevice.setDescription(chargingPile.getNumber().toString()); AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData(); if(null != deviceResp){ int httpStatusCode = deviceResp.getHttpStatusCode(); if(httpStatusCode == 201){ chargingPile.setIotdDeviceId(deviceResp.getDeviceId()); // AddDevice addDevice = new AddDevice(); // addDevice.setProductId("66da68d21837002b28b34ec0"); // addDevice.setNodeId(chargingPile.getCode()); // addDevice.setDeviceName(chargingPile.getName()); // addDevice.setDescription(chargingPile.getNumber().toString()); // AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData(); // if(null != deviceResp){ // int httpStatusCode = deviceResp.getHttpStatusCode(); // if(httpStatusCode == 201){ // chargingPile.setIotdDeviceId(deviceResp.getDeviceId()); // } // } this.save(chargingPile); } } return AjaxResult.success(); } @@ -266,12 +266,12 @@ for (Integer id : ids) { TChargingPile chargingPile = this.getById(id); //调用华为Iot删除设备 if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); if(null != deviceResp && deviceResp.getHttpStatusCode() == 0){ // if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ // DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); // if(null != deviceResp && deviceResp.getHttpStatusCode() == 0){ // } // } this.removeById(chargingPile); } } } return AjaxResult.success(); } @@ -586,25 +586,39 @@ */ @Override public void updateStatus() { List<TChargingPile> list = this.list(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getDelFlag, 0)); List<TChargingPile> datas = new ArrayList(); Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_pile_online"); for (TChargingPile chargingPile : list) { Long time = (Long) charging_pile_online.get(chargingPile.getCode()); if(null != time && System.currentTimeMillis() - time > 60000){ chargingPile.setStatus(2); datas.add(chargingPile); Map<String, Object> charging_gun_online = redisService.getCacheMap("charging_gun_online"); Set<String> keySet = charging_gun_online.keySet(); List<TChargingGun> list = new ArrayList<>(); if(keySet.size() > 0){ list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getFullNumber, keySet)); } for (TChargingGun chargingGun : list) { Long time = (Long) charging_gun_online.get(chargingGun.getFullNumber()); if(null != time && System.currentTimeMillis() - time > 60000){ TChargingGun chargingGun1 = new TChargingGun(); chargingGun1.setId(chargingGun.getId()); chargingGun1.setStatus(1); chargingGunService.updateById(chargingGun1); //桩处于正常,桩所属的枪都处于非正常,修改桩状态为异常 TChargingPile chargingPile = this.getById(chargingGun.getChargingPileId()); List<TChargingGun> list1 = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0)); int size = list1.stream().filter(s -> s.getStatus() == 1 || s.getStatus() == 7).collect(Collectors.toList()).size(); if(chargingPile.getStatus() == 1 && list1.size() == size){ TChargingPile chargingPile1 = new TChargingPile(); chargingPile1.setId(chargingGun.getChargingPileId()); chargingPile1.setStatus(2); this.updateById(chargingPile1); } if(datas.size() > 0){ for (TChargingPile data : datas) { TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, data.getId()) .eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); //添加记录 TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingGun.getChargingPileId()) .eq(TFaultMessage::getChargingGunId, chargingGun.getId()).eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); if(null == faultMessage){ faultMessage = new TFaultMessage(); faultMessage.setSiteId(data.getSiteId()); faultMessage.setChargingPileId(data.getId()); faultMessage.setSiteId(chargingGun.getSiteId()); faultMessage.setChargingPileId(chargingGun.getChargingPileId()); faultMessage.setChargingGunId(chargingGun.getId()); faultMessage.setStatus(1); faultMessage.setDownTime(LocalDateTime.now()); faultMessage.setCreateTime(LocalDateTime.now()); @@ -613,7 +627,6 @@ faultMessageService.save(faultMessage); } } this.updateBatchById(datas); } } } ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/SiteMapper.xml
@@ -154,13 +154,14 @@ a.service_charge AS serviceCharge, a.electrovalence AS electrovalenceOriginal, (a.electrovalence+a.service_charge) AS electrovalence, (a.electrovalence + (a.service_charge*b.discount)) AS vipElectrovalence (a.electrovalence + (a.service_charge*(CASE WHEN b.discount IS NULL THEN 1 ELSE b.discount END))) AS vipElectrovalence from t_accounting_strategy_detail a left join t_accounting_strategy b on (a.accounting_strategy_id = b.id) where b.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND DATE_FORMAT(NOW(), '%H:%i:%s') between a.start_time and a.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) AND DATE_FORMAT(NOW(), '%H:%i:%s') between a.start_time and CASE WHEN a.end_time = '00:00' THEN '23:59:59' ELSE a.end_time END) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) <where> <if test="null != query.name and '' != query.name"> and ts.`name` like CONCAT('%', #{query.name}, '%') @@ -288,19 +289,20 @@ a.service_charge AS serviceCharge, a.electrovalence AS electrovalenceOriginal, (a.electrovalence+a.service_charge) AS electrovalence, (a.electrovalence+(a.service_charge*b.discount)) AS vipElectrovalence (a.electrovalence+(a.service_charge*(CASE WHEN b.discount IS NULL THEN 1 ELSE b.discount END))) AS vipElectrovalence from t_accounting_strategy_detail a left join t_accounting_strategy b on (a.accounting_strategy_id = b.id) where b.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND DATE_FORMAT(NOW(), '%H:%i:%s') between a.start_time and a.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) AND DATE_FORMAT(NOW(), '%H:%i:%s') between a.start_time AND CASE WHEN a.end_time = '00:00' THEN '23:59:59' ELSE a.end_time END) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) <where> <if test="null != query.name and '' != query.name"> and ts.`name` like CONCAT('%', #{query.name}, '%') </if> <if test="null != query.cityCode and '' != query.cityCode"> and ts.cityCode = #{query.cityCode} and ts.city_code = #{query.cityCode} </if> AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TAccountingStrategyMapper.xml
@@ -43,6 +43,25 @@ ORDER BY create_time DESC </select> <select id="pageList1" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO"> SELECT id, site_id, `name`, description, discount,first_user_id,two_user_id,first_remark,two_remark,audit_status,first_audit_time,two_audit_time, create_time, del_flag,user_id,parent_id FROM t_accounting_strategy <where> <if test="query.name != null and query.name != ''"> AND `name` LIKE concat('%',#{query.name}, '%') </if> <if test="query.auditStatus != null"> AND audit_status = #{query.auditStatus} </if> AND site_id IS NULL AND (parent_id IS NULL OR audit_status = 1 OR audit_status = 2) AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} </where> ORDER BY create_time DESC </select> <select id="getPlatformAccountingStrategy" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO"> ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/model/SwitchwayGate.java
@@ -1,9 +1,13 @@ package com.ruoyi.integration.barrierGate.model; import com.alibaba.nacos.common.utils.MD5Utils; import com.ruoyi.common.core.utils.MD5Util; import lombok.Data; import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; import org.apache.tomcat.util.security.MD5Encoder; import java.nio.charset.Charset; /** * @author zhibing.pu @@ -46,5 +50,4 @@ this.setSign(encoder); return this; } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java
@@ -51,6 +51,7 @@ parkingRecord.setCode(code); parkingRecord.setVehicleColor(order.getPlateColor()); TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); parkingRecord.setName(data.getName()); parkingRecord.setParkingLotId(data.getId()); parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEnterDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); parkingRecord.setStatus(1); @@ -101,6 +102,7 @@ parkingRecord.setCode(code); parkingRecord.setVehicleColor(order.getPlatecolor()); TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); parkingRecord.setName(data.getName()); parkingRecord.setParkingLotId(data.getId()); parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEntertime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); parkingRecord.setStatus(1); ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java
@@ -40,18 +40,4 @@ } return success; } // public static void main(String[] args) { // SwitchwayGateService switchwayGateService = new SwitchwayGateService(); // SwitchwayGateReq req = new SwitchwayGateReq(); // req.setAction("close"); // req.setChannel("001"); // Boolean success = switchwayGateService.gateService(req); // if(success){ // log.info("调用成功"); // }else{ // log.info("调用失败"); // } // } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/UploadRealTimeMonitoringDataController.java
@@ -79,6 +79,12 @@ return R.ok(list); } @PostMapping(value = "/delete") public R delete(@RequestParam String id) throws ParseException { uploadRealTimeMonitoringDataService.delete(id); return R.ok(); } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/UploadRealTimeMonitoringDataService.java
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.dto.MongoChargingOrderQuery; import java.text.ParseException; import java.util.Date; import java.util.List; public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { @@ -25,4 +26,7 @@ */ UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); void delete(String id); void updateById(String id); } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java
@@ -8,12 +8,14 @@ import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; import com.ruoyi.common.core.dto.MongoChargingOrderQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; import org.springframework.stereotype.Service; import java.text.ParseException; @@ -70,7 +72,6 @@ if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(), "i")); // "i" 表示不区分大小写 } if (mongoChargingOrderQuery.getOrderType() !=null){ query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); } @@ -109,20 +110,35 @@ // 设置分页 long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageCurr(), mongoChargingOrderQuery.getPageSize()); // 创建带有排序的 Pageable 对象 Pageable pageable = PageRequest.of( mongoChargingOrderQuery.getPageCurr()-1, mongoChargingOrderQuery.getPageSize(), Sort.by(Sort.Direction.DESC, "create_time") ); // 设置分页和排序 query.with(pageable); query.with(Sort.by(Sort.Direction.DESC,"create_time")); // 执行查询并获取 Page 对象 List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); // 设置分页 // Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); // query.with(pageable); // query.with(Sort.by(Sort.Direction.DESC,"create_time")); List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( query , UploadRealTimeMonitoringData.class); UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); uploadRealTimeMonitoringPageData.setCount(totalElements); uploadRealTimeMonitoringPageData.setRecords(uploadRealTimeMonitoringData); uploadRealTimeMonitoringPageData.setRecords(page); return uploadRealTimeMonitoringPageData; } @@ -139,4 +155,20 @@ return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); } @Override public void delete(String id) { UploadRealTimeMonitoringData byId = findById(id.toString()); mongoTemplate.remove(byId); } @Override public void updateById(String id) { // 创建查询条件 Query query = new Query(Criteria.where("_id").is(id)); // 创建更新对象 Update update = new Update().set("last_time", new Date()); // 执行更新操作 mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/ChargingMessageListener.java
@@ -149,7 +149,7 @@ BeanUtils.copyProperties(pingMessage,ping); pingService.create(ping); chargingPileClient.updateChargingPileStatus(pingMessage.getCharging_pile_code(), pingMessage.getCharging_gun_status()); chargingPileClient.updateChargingPileStatus(pingMessage.getCharging_pile_code(), pingMessage.getCharging_gun_code(), pingMessage.getCharging_gun_status()); break; case SendTagConstant.END_CHARGE: EndChargeMessage endChargeMessage = message.getEndChargeMessage(); @@ -201,7 +201,7 @@ uploadRealTimeMonitoringData.setElectrovalence_all(accountingStrategyDetail.getElectrovalence()); uploadRealTimeMonitoringData.setService_charge(accountingStrategyDetail.getServiceCharge()); if (Objects.nonNull(data)) { data.setLast_time(new Date()); uploadRealTimeMonitoringDataService.updateById(data.getId()); uploadRealTimeMonitoringData.setPeriod_electric_price(uploadRealTimeMonitoringDataMessage.getPaid_amount().subtract(data.getPaid_amount())); uploadRealTimeMonitoringData.setPeriod_charging_degree(uploadRealTimeMonitoringDataMessage.getCharging_degree().subtract(data.getCharging_degree())); uploadRealTimeMonitoringData.setPeriod_service_price(uploadRealTimeMonitoringDataMessage.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); @@ -224,47 +224,6 @@ UploadRealTimeMonitoringDataQuery query = new UploadRealTimeMonitoringDataQuery(); BeanUtils.copyProperties(uploadRealTimeMonitoringData, query); chargingOrderClient.chargeMonitoring(query); GetChargingGunByCode code = new GetChargingGunByCode(); code.setCharging_pile_code(uploadRealTimeMonitoringDataMessage.getCharging_pile_code()); code.setCharging_gun_code(uploadRealTimeMonitoringDataMessage.getCharging_gun_code()); TChargingGun chargingGun = chargingGunClient.getChargingGunByCode(code).getData(); if(Objects.nonNull(chargingGun)){ // 存储状态信息 TFaultMessage faultMessage = new TFaultMessage(); if(uploadRealTimeMonitoringDataMessage.getCharging_gun_status().equals(0) || uploadRealTimeMonitoringDataMessage.getCharging_gun_status().equals(1)){ faultMessage.setSiteId(chargingGun.getSiteId()); faultMessage.setChargingPileId(chargingGun.getChargingPileId()); faultMessage.setChargingGunId(chargingGun.getId()); switch (uploadRealTimeMonitoringDataMessage.getCharging_gun_status()){ case 0: faultMessage.setStatus(1); chargingGun.setStatus(1); break; case 1: faultMessage.setStatus(2); chargingGun.setStatus(7); break; } faultMessage.setDownTime(LocalDateTime.now()); faultMessageClient.createFaultMessage(faultMessage); }else { switch (uploadRealTimeMonitoringDataMessage.getCharging_gun_status()){ case 2: chargingGun.setStatus(2); break; case 3: chargingGun.setStatus(4); break; } // 空闲 充电 查询是否该设备之前存在离线记录或者故障记录 faultMessage = faultMessageClient.getFaultMessageByGunId(chargingGun.getId()).getData(); if(Objects.nonNull(faultMessage)){ faultMessage.setEndTime(LocalDateTime.now()); faultMessageClient.updateFaultMessage(faultMessage); } } chargingGunClient.updateChargingGunById(chargingGun); } } catch (Exception e) { e.printStackTrace(); } @@ -378,10 +337,12 @@ // 添加实时上传记录结束记录 // 查询mogondb上一条数据 UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(transactionRecordMessage.getTransaction_serial_number()); if(Objects.nonNull(data) && data.getStatus() != 5){ UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); BeanUtils.copyProperties(data,uploadRealTimeMonitoringData); uploadRealTimeMonitoringData.setStatus(5); uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); } break; case SendTagConstant.UPDATE_BALANCE_REPLY: UpdateBalanceReplyMessage updateBalanceReplyMessage = message.getUpdateBalanceReplyMessage(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
@@ -74,7 +74,8 @@ ChargingBillVO res = chargingBillService.chargingBillList1(dto); List<ChargingBillListVO> records = res.getList().getRecords(); accountListVO.setBillCount(records.size()); accountListVO.setTotalAmount(res.getOrderAmount()); accountListVO.setTotalAmount(res.getOrderAmount().subtract(res.getRefundAmount()) .subtract(res.getCommissionAmount()).subtract(res.getSharingAmount())); accountListVO.setPaymentAmount(res.getPaymentAmount()); accountListVO.setRefundAmount(res.getRefundAmount()); accountListVO.setCommissionAmount(res.getCommissionAmount()); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -348,7 +348,6 @@ public AjaxResult<ChargingOrderInfoVO> chargingOrderInfo(String strategyId) { TChargingOrder byId = chargingOrderService.getById(strategyId); ChargingOrderInfoVO chargingOrderInfoVO = new ChargingOrderInfoVO(); chargingOrderInfoVO.setCdElectronic(byId.getCurrent()!=null?byId.getCurrent().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); chargingOrderInfoVO.setCdVoltage(byId.getVoltage()!=null?byId.getVoltage().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()!=null?byId.getTotalElectricity().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); @@ -511,7 +510,7 @@ @PostMapping(value = "/chargingOrderWXCallback") public void chargingOrderWXCallback(@RequestParam("out_trade_no") String out_trade_no, @RequestParam("transaction_id") String transaction_id, @RequestParam("attach") String attach) { AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach); chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach); } @@ -841,6 +840,13 @@ @ResponseBody @GetMapping(value = "/watch/deletes") @ApiOperation(value = "监控订单-删除", tags = {"管理后台-订单管理"}) public R watchChargingOrder(@RequestParam String id) { uploadRealTimeMonitoringDataClient.delete(id); return R.ok(); } /** * 处理充电订单实时监控数据相关的业务逻辑 @@ -1673,7 +1679,7 @@ Long userId = tokenService.getLoginUserApplet().getUserId(); List<TChargingOrder> list = chargingOrderService.list(Wrappers.lambdaQuery(TChargingOrder.class) .eq(TChargingOrder::getAppUserId, userId) .eq(TChargingOrder::getStatus, 3)); .in(TChargingOrder::getStatus, Arrays.asList(1,2,3,4))); List<Integer> gunIds = list.stream().map(TChargingOrder::getChargingGunId).collect(Collectors.toList()); return R.ok(gunIds); } @@ -1777,4 +1783,16 @@ EndOfChargePageInfo endOfChargePageInfo = chargingOrderService.getEndOfChargePageInfo(id); return AjaxResult.success(endOfChargePageInfo); } /** * 获取订单数据 * @param order * @return */ @PostMapping("/getChargingOrder") public R<List<TChargingOrder>> getChargingOrder(@RequestBody TChargingOrderVo order){ List<TChargingOrder> chargingOrder = chargingOrderService.getChargingOrder(order); return R.ok(chargingOrder); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java
@@ -28,6 +28,8 @@ import com.ruoyi.order.service.TShoppingOrderService; import com.ruoyi.common.core.dto.ExchangeDto; import com.ruoyi.common.core.utils.OrderCodeUtil; import com.ruoyi.other.api.domain.TCoupon; import com.ruoyi.other.api.domain.TGoods; import com.ruoyi.other.api.feignClient.CouponClient; import com.ruoyi.other.api.feignClient.GoodsClient; import com.ruoyi.payment.api.feignClient.AliPaymentClient; @@ -119,6 +121,20 @@ byId.setReceivingAddress(data.getAddress()); } } switch (byId.getOrderType()){ case 1: TGoods data = goodsClient.getGoodsById(byId.getGoodsId()).getData(); if (data!=null){ byId.setName(data.getName()); } break; case 2: TCoupon data1 = couponClient.getCouponById1(byId.getCouponId()).getData(); if (data1!=null){ byId.setName(data1.getName()); } break; } return AjaxResult.success(byId); } @Resource ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java
@@ -1,9 +1,11 @@ package com.ruoyi.order.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.order.api.model.TOrderEvaluate; import com.ruoyi.order.api.model.TOrderEvaluateTag; import com.ruoyi.order.api.query.TOrderEvaluateQuery; import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; import com.ruoyi.order.api.vo.TOrderEvaluateVO; @@ -11,12 +13,14 @@ import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; import com.ruoyi.order.dto.OrderEvaluateVo; import com.ruoyi.order.service.TOrderEvaluateService; import com.ruoyi.order.service.TOrderEvaluateTagService; import com.ruoyi.order.vo.ReplyEvaluationVO; import com.ruoyi.other.api.vo.TEvaluationTagVO; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.List; @@ -35,6 +39,11 @@ @Autowired private TOrderEvaluateService orderEvaluateService; @Resource private TOrderEvaluateTagService orderEvaluateTagService; @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") @@ -69,6 +78,7 @@ public AjaxResult delOrderEvaluate(@PathVariable("id") Long id){ TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id); orderEvaluateService.removeById(orderEvaluate); orderEvaluateTagService.remove(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, id)); return AjaxResult.success(); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java
@@ -82,6 +82,13 @@ private SysUserClient sysUserClient; @Resource private TShoppingOrderRefundService shoppingOrderRefundService; @Resource private AppUserAddressClient appUserAddressClient; /** * 远程管理后台取消订单后退款回调 */ @@ -350,8 +357,7 @@ return AjaxResult.success(list); } @Resource private AppUserAddressClient appUserAddressClient; @PostMapping("/create") public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto) { TShoppingOrder shoppingOrder = new TShoppingOrder(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
@@ -18,6 +18,7 @@ import com.ruoyi.order.dto.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.order.vo.EndOfChargePageInfo; import org.springframework.web.bind.annotation.RequestBody; import java.time.LocalDate; import java.util.List; @@ -268,4 +269,12 @@ EndOfChargePageInfo getEndOfChargePageInfo(String id); Long countNoTag(); /** * 获取订单数据 * @param order * @return */ List<TChargingOrder> getChargingOrder(TChargingOrderVo order); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -91,6 +91,7 @@ chargingBillVO.setOrderCount(list1.size()); BigDecimal paymentAmountTotal = new BigDecimal("0"); BigDecimal orderAmountTotal = new BigDecimal("0"); BigDecimal refundAmountTotal = new BigDecimal("0"); BigDecimal electrovalenceTotal = new BigDecimal("0"); BigDecimal serviceChargeTotal = new BigDecimal("0"); BigDecimal commissionAmountTotal = new BigDecimal("0"); @@ -248,11 +249,11 @@ } } if (data3!=null)tChargingOrder.setUserName(data3.getName()); // 累加实收金额 // 累加实收金额 支付结算金额 if (tChargingOrder.getOrderAmount()!=null){ paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); } // 累加订单金额 // 入账金额 if (tChargingOrder.getOrderAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); } @@ -263,7 +264,7 @@ List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { refundAmount = refundAmount.add(tChargingOrderRefund.getRefundAmount()); refundAmount = refundAmount.add(tChargingOrderRefund.getRefundTotalAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -298,8 +299,8 @@ .subtract(chargingBillVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillVO.getCommissionAmount()) .subtract(chargingBillVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillVO.getSharingAmount())); chargingBillListVO.setPaymentAmount(paymentAmount == null?BigDecimal.ZERO:paymentAmount); chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount); chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:orderAmount); chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount.subtract(refundAmount).subtract(commissionAmount).subtract(sharingAmount)); chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount); chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge); chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); @@ -364,6 +365,7 @@ }else if (tChargingOrder.getPaymentAmount()!=null){ paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); } // 累加订单金额 if (tChargingOrder.getOrderAmount()!=null){ orderAmountTotal = orderAmountTotal.add(tChargingOrder.getOrderAmount()); @@ -372,8 +374,10 @@ if (tChargingOrder.getElectrovalence()!=null){ electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); } if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus()!=null&& tChargingOrder.getRefundStatus()==2){ refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()) .eq(TChargingOrderRefund::getRefundStatus, 2).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { refundAmountTotal =refundAmountTotal.add(tChargingOrder.getRefundAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -410,7 +414,7 @@ chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setDiscount(discountTotal); chargingBillVO.setRefundAmount(refundAmountTotal); pageInfo.setRecords(list); chargingBillVO.setList(pageInfo); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -50,6 +50,7 @@ import com.ruoyi.order.vo.EndOfChargePageInfo; import com.ruoyi.other.api.domain.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.feignClient.*; import com.ruoyi.payment.api.feignClient.AliPaymentClient; import com.ruoyi.payment.api.feignClient.WxPaymentClient; @@ -65,10 +66,12 @@ import org.springframework.util.StringUtils; import javax.annotation.Resource; import javax.crypto.MacSpi; import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.*; import java.time.format.DateTimeFormatter; @@ -384,7 +387,7 @@ TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId()) .in(TChargingOrder::getStatus, Arrays.asList(1, 2, 3)).eq(TChargingOrder::getDelFlag, 0)); if(null != one){ return AjaxResult.error("充电枪正在充电桩中,启动失败"); return AjaxResult.error("充电枪正在充电中,启动失败"); } //查询当前充电枪是否有正在支付的订单 one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId()) @@ -444,6 +447,7 @@ chargingOrder.setVipDiscountAmount(BigDecimal.ZERO); chargingOrder.setOrderSource(0); chargingOrder.setTitle("【充电桩充电】" + chargingPile.getNumber() + "号桩/" + tChargingGun.getCode() + "号枪"); chargingOrder.setStatus(1); Site site = siteClient.getSiteByIds(Arrays.asList(tChargingGun.getSiteId())).getData().get(0); Integer accountingStrategyId = tChargingGun.getAccountingStrategyId(); @@ -656,10 +660,104 @@ log.error(chargingOrder.getCode() + ":-------------------远程调起开始充电请求-------------------" + platformStartCharging.toString()); sendMessageClient.platformStartCharging(platformStartCharging); //异步线程检测远程启动的应答结果。如果失败,则需要全额退款 Long id = chargingOrder.getId(); //执行5分钟的定时任务检测 ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(()->{ if(timingDetection(id)){ scheduler.shutdown(); } }, 5, 1, TimeUnit.SECONDS); return AjaxResult.success(); } /** * 定时检测mongodb数据库数据 * @param id * @return */ public boolean timingDetection(Long id){ TChargingOrder chargingOrder = this.getById(id); if(chargingOrder.getStatus() != 2){ return true; } String code = chargingOrder.getCode(); String key = "AQJC_" + chargingOrder.getChargingGunId(); List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); log.error(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); if(data.size() != 0){ PlatformStartChargingReply platformStartChargingReply = data.get(1); Integer startup_result = platformStartChargingReply.getStartup_result(); Integer failure_cause = platformStartChargingReply.getFailure_cause(); Integer counter = counter_map.get(code); PreChargeCheck preChargeCheck1 = redisService.getCacheObject(key); //5分钟内还未插枪则取消充电,退回金额。 if(failure_cause == 5 && (null == counter || counter < 300)){ counter = (null == counter ? 0 : counter) + 1; counter_map.put(code, counter); //启动失败 preChargeCheck1.setStartupSuccess(3); preChargeCheck1.setFailureCause(failure_cause); redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); return false; } //清除计时器中的无效数据 counter_map.remove(code); TChargingOrder order = new TChargingOrder(); order.setId(id); order.setAppUserId(chargingOrder.getAppUserId()); if(0 == startup_result){ //启动失败 preChargeCheck1.setStartupSuccess(3); preChargeCheck1.setFailureCause(failure_cause); //启动失败后取消订单,退款操作 refund(code); order.setStatus(-1); order.setEndMode(0); }else{ //启动成功 preChargeCheck1.setStartupSuccess(2); order.setStatus(3); order.setStartTime(LocalDateTime.now()); } this.updateById(order); redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); return true; }else{ Integer counter = boot_failed_map.get(code); log.error(code + ":-------------------未上传开启充电结果-------------------" + counter); PreChargeCheck preChargeCheck1 = redisService.getCacheObject(key); //5分钟内未启动成功,退回金额。 if(null == counter || counter < 300){ counter = (null == counter ? 0 : counter) + 1; boot_failed_map.put(code, counter); //启动失败 preChargeCheck1.setStartupSuccess(1); preChargeCheck1.setFailureCause(0); redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); return false; } //清除计时器中的无效数据 boot_failed_map.remove(code); TChargingOrder order = new TChargingOrder(); order.setId(id); order.setAppUserId(chargingOrder.getAppUserId()); //启动失败 preChargeCheck1.setStartupSuccess(3); preChargeCheck1.setFailureCause(0); //启动失败后取消订单,退款操作 refund(code); order.setStatus(-1); order.setEndMode(0); this.updateById(order); redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS); return true; } } /** @@ -798,7 +896,10 @@ one.setRefundTime(LocalDateTime.now()); chargingOrderRefundService.updateById(one); TChargingOrder chargingOrder = this.getById(one.getChargingOrderId()); TChargingOrder order = this.getById(one.getChargingOrderId()); TChargingOrder chargingOrder = new TChargingOrder(); chargingOrder.setId(one.getChargingOrderId()); chargingOrder.setAppUserId(order.getAppUserId()); chargingOrder.setRefundStatus(2); chargingOrder.setRefundSerialNumber(refund_id); chargingOrder.setRefundTime(LocalDateTime.now()); @@ -866,25 +967,29 @@ @Override @GlobalTransactional(rollbackFor = Exception.class) public AjaxResult stopCharging(String id) { TChargingOrder chargingOrder = this.getById(id); Integer status = chargingOrder.getStatus(); TChargingOrder order = this.getById(id); Integer status = order.getStatus(); if(status != 3){ return AjaxResult.error("还未开始充电"); } if(status == 4 || status == 5){ return AjaxResult.error("不能重复操作"); } TChargingOrder chargingOrder = new TChargingOrder(); chargingOrder.setId(Long.valueOf(id)); chargingOrder.setAppUserId(order.getAppUserId()); chargingOrder.setEndTime(LocalDateTime.now()); chargingOrder.setStatus(4); chargingOrder.setEndMode(1); this.updateById(chargingOrder); String code1 = chargingOrder.getCode(); TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData(); String code1 = order.getCode(); TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData(); //异步线程处理停机 ExecutorService cachedThreadPool = Executors.newFixedThreadPool(1); cachedThreadPool.execute(()->{ //调用硬件停止充电,停止成功后开始计算费用退款 TChargingPile chargingPile = chargingPileClient.getChargingPileById(chargingOrder.getChargingPileId()).getData(); TChargingPile chargingPile = chargingPileClient.getChargingPileById(order.getChargingPileId()).getData(); PlatformStopCharging platformStopCharging = new PlatformStopCharging(); platformStopCharging.setCharging_pile_code(chargingPile.getCode()); platformStopCharging.setCharging_gun_code(chargingGun.getCode()); @@ -991,6 +1096,7 @@ inviteUser.setAward(num1); inviteUserClient.updateInviteUser(inviteUser); } if(num1 > 0){ TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); appUserIntegralChange.setCode(code); @@ -1005,6 +1111,7 @@ appUser1.setPoints(appUser1.getPoints() + num1); appUserClient.updateAppUser(appUser1); } } } @@ -1585,7 +1692,6 @@ chargingOrderListInfoVO.setCouponDiscountAmount(chargingOrder.getCouponDiscountAmount()); chargingOrderListInfoVO.setVipDiscountAmount(chargingOrder.getVipDiscountAmount()); chargingOrderListInfoVO.setSharingAmount(chargingOrder.getSharingAmount()); chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getCommissionAmount()); // 查询费用明细列表 List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery() .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId()) @@ -1665,7 +1771,7 @@ public void endChargeBillingCharge(TransactionRecordMessageVO vo) { TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number())); Integer status = chargingOrder.getStatus(); if(status == 4 || status == 5){ if(status == 5){ return; } @@ -1681,6 +1787,8 @@ //开始处理计费明细数据和优惠数据 chargingOrderAccountingStrategyService.remove(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId())); SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); List<AccountingStrategyDetailOrderVo> lists = new ArrayList<>(); for (int i = 0; i < accountingStrategyDetailOrderList.size(); i++) { Class<? extends TransactionRecordMessageVO> clazz = vo.getClass(); try { @@ -1709,15 +1817,75 @@ continue; } BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); BeanUtils.copyProperties(strategyDetail, vo1); vo1.setStart(sdfs.parse(vo.getStart_time().split(" ")[0] + " " + strategyDetail.getStartTime() + ":00").getTime()); vo1.setEnd(sdfs.parse(vo.getStart_time().split(" ")[0] + " " + strategyDetail.getEndTime() + ":00").getTime()); vo1.setChargingCapacity(sharp_peak_charge); lists.add(vo1); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } catch (ParseException e) { throw new RuntimeException(e); } } Collections.sort(lists, new Comparator<AccountingStrategyDetailOrderVo>() { public int compare(AccountingStrategyDetailOrderVo s1, AccountingStrategyDetailOrderVo s2) { return s1.getStart() < s2.getStart() ? -1 : s1.getStart() == s2.getStart() ? 0 : 1; } }); if(!vo.getStart_time().split(" ")[0].equals(vo.getEnd_time().split(" ")[0])){ List<AccountingStrategyDetailOrderVo> list1 = new ArrayList<>(lists); for (AccountingStrategyDetailOrderVo orderVo : list1) { Calendar start = Calendar.getInstance(); start.setTimeInMillis(orderVo.getStart()); start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); orderVo.setStart(start.getTimeInMillis()); Calendar end = Calendar.getInstance(); end.setTimeInMillis(orderVo.getEnd()); end.set(Calendar.DAY_OF_YEAR, end.get(Calendar.DAY_OF_YEAR) + 1); orderVo.setEnd(end.getTimeInMillis()); } lists.addAll(list1); } //开始处理明细 SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS"); SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm"); Date start = null; Date end = null; try { start = sdf3.parse(vo.getStart_time()); end = sdf3.parse(vo.getEnd_time()); } catch (ParseException e) { throw new RuntimeException(e); } for (AccountingStrategyDetailOrderVo strategyDetail : lists) { BigDecimal sharp_peak_charge = strategyDetail.getChargingCapacity(); TChargingOrderAccountingStrategy chargingOrderAccountingStrategy = new TChargingOrderAccountingStrategy(); chargingOrderAccountingStrategy.setChargingOrderId(chargingOrder.getId()); chargingOrderAccountingStrategy.setAccountingStrategyDetailId(strategyDetail.getId()); chargingOrderAccountingStrategy.setType(strategyDetail.getType()); chargingOrderAccountingStrategy.setStartTime(chargingOrder.getStartTime().format(DateTimeFormatter.ofPattern("HH:mm"))); chargingOrderAccountingStrategy.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm"))); chargingOrderAccountingStrategy.setElectrovalence(strategyDetail.getElectrovalence()); chargingOrderAccountingStrategy.setServiceCharge(strategyDetail.getServiceCharge()); chargingOrderAccountingStrategy.setCostServiceCharge(strategyDetail.getCostServiceCharge()); if(start.getTime() >= strategyDetail.getStart()){ chargingOrderAccountingStrategy.setStartTime(sdf2.format(start)); }else{ chargingOrderAccountingStrategy.setStartTime(strategyDetail.getStartTime()); } if(end.getTime() >= strategyDetail.getEnd()){ chargingOrderAccountingStrategy.setEndTime(strategyDetail.getEndTime()); }else{ chargingOrderAccountingStrategy.setEndTime(sdf2.format(end)); } //已充电总度数 BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); @@ -1739,14 +1907,8 @@ 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) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } //原金额 @@ -1876,9 +2038,10 @@ 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())); BigDecimal reduce = list.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); for (TChargingOrderAccountingStrategy chargingOrderAccountingStrategy : list) { BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodServicePrice(); BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(periodServicePrice_total, new MathContext(4, RoundingMode.HALF_EVEN))); BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(reduce, new MathContext(4, RoundingMode.HALF_EVEN))); periodServicePrice = periodServicePrice.subtract(multiply); chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice); chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply); @@ -1908,6 +2071,7 @@ } } if(integral > 0){ TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); appUserIntegralChange.setAppUserId(appUser.getId()); appUserIntegralChange.setChangeType(2); @@ -1919,6 +2083,7 @@ appUserIntegralChange.setExtension(chargingOrder.getId().toString()); appUserClient.updateAppUser(appUser); appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); } } //计算用户标签 @@ -1942,7 +2107,7 @@ chargingOrderRefund.setRefundTitle("充电完成退款"); chargingOrderRefund.setRefundContent("充电完成退款"); chargingOrderRefund.setRefundReason("充电完成退款"); chargingOrderRefund.setRefundRemark("实际充电消费金额:" + refundAmount); chargingOrderRefund.setRefundRemark("实际充电消费金额:" + chargingOrder.getPaymentAmount()); chargingOrderRefund.setRefundTotalAmount(refundAmount); chargingOrderRefund.setPayAmount(rechargeAmount); if(1 == rechargePaymentType){ @@ -2287,7 +2452,7 @@ } TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, appUserCar.getId()) .eq(TChargingOrder::getDelFlag, 0).gt(TChargingOrder::getStartTime, query.getStartTime()) .eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, -1)); .eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, 5)); return one; } @@ -2803,4 +2968,32 @@ public Long countNoTag() { return this.baseMapper.countNoTag(); } @Override public List<TChargingOrder> getChargingOrder(TChargingOrderVo order) { LambdaQueryWrapper<TChargingOrder> queryWrapper = new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getDelFlag, 0); if(null != order.getChargingPileId()){ queryWrapper.eq(TChargingOrder::getChargingPileId, order.getChargingPileId()); } if(null != order.getChargingGunId()){ queryWrapper.eq(TChargingOrder::getChargingGunId, order.getChargingGunId()); } if(null != order.getStatus()){ queryWrapper.eq(TChargingOrder::getStatus, order.getStatus()); } if(null != order.getAppUserId()){ queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId()); } if(null != order.getAppUserId()){ queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId()); } if(null != order.getStatusList()){ queryWrapper.in(TChargingOrder::getAppUserId, order.getStatusList()); } if(null != order.getEndMode()){ queryWrapper.eq(TChargingOrder::getEndMode, order.getEndMode()); } return this.list(queryWrapper.orderByDesc(TChargingOrder::getCreateTime)); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -139,7 +139,8 @@ tagList = tagList.stream().sorted(Comparator.comparing(TEvaluationTagVO::getTagCount).reversed()).collect(Collectors.toList()); // 统计有图,好评,中差评数量 long imgUrlCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) .isNotNull(TOrderEvaluate::getImgUrl)); .isNotNull(TOrderEvaluate::getImgUrl) .ne(TOrderEvaluate::getImgUrl,"")); packageTagCount(imgUrlCount,"有图",2,tagList); long goodCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) .ge(TOrderEvaluate::getMark,4)); @@ -172,9 +173,11 @@ orderEvaluateVO.setName(appUser.getName()); orderEvaluateVO.setAvatar(appUser.getAvatar()); } if(Objects.nonNull(orderEvaluateVO.getAppUserCarId())){ TAppUserCar appUserCar = appUserCars.stream().filter(car -> car.getId().equals(Long.parseLong(String.valueOf(orderEvaluateVO.getAppUserCarId())))).findFirst().orElse(null); if(Objects.nonNull(appUserCar)){ orderEvaluateVO.setCarName(appUserCar.getVehicleBrand()); } } }); pageInfo.setRecords(list); @@ -205,6 +208,11 @@ List<Integer> tagIds = tOrderEvaluateTagList.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); tOrderEvaluateVO.setOrderEvaluateTags(data); } TAppUser data = appUserClient.getUserById(tOrderEvaluateVO.getAppUserId()).getData(); if(Objects.nonNull(data)){ tOrderEvaluateVO.setName(data.getName()); tOrderEvaluateVO.setAvatar(data.getAvatar()); } } } @@ -379,9 +387,11 @@ BeanUtils.copyProperties(orderEvaluate, orderEvaluateVo); List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, orderEvaluate.getId())); List<Integer> tagId = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); if(tagId.size() > 0){ List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagId).getData(); List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); orderEvaluateVo.setTagName(collect); } return orderEvaluateVo; } return null; ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java
@@ -218,6 +218,8 @@ BigDecimal payMoney = tChargingOrder.getStatus() < 4 ? tChargingOrder.getRechargeAmount() : tChargingOrder.getPaymentAmount(); myChargingOrderList.setPayMoney(payMoney); myChargingOrderList.setCreateTime(tChargingOrder.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss"))); myChargingOrderList.setElectricCharge(tChargingOrder.getElectrovalence()); myChargingOrderList.setServiceCharge(tChargingOrder.getServiceCharge()); chargingOrder.add(myChargingOrderList); } myOrderInvoiceInfo.setChargingOrder(chargingOrder); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -1,5 +1,6 @@ package com.ruoyi.order.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -315,7 +316,7 @@ MyShoppingOrderInfo info = new MyShoppingOrderInfo(); info.setId(id); info.setStatus(shoppingOrder.getStatus()); TAppUserAddress userAddress = appUserAddressClient.getAppUserAddressById(shoppingOrder.getAppUserAddressId()).getData(); TAppUserAddress userAddress = JSON.parseObject(shoppingOrder.getAddressJson(), TAppUserAddress.class); info.setConsignee(userAddress.getName()); info.setPhone(userAddress.getPhone()); info.setAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getAddress() + userAddress.getHouseNumber()); ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
@@ -40,6 +40,7 @@ <choose> <when test="query.tagType == 2"> AND toe.img_url IS NOT NULL AND toe.img_url != '' </when> <when test="query.tagType == 3"> AND toe.mark >= 4 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml
@@ -152,9 +152,7 @@ <if test="null != req.code and req.code!=''"> and t3.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="req.type == null "> and t3.discount_amount > 0 </if> <if test="null != req.userIds and req.userIds.size()>0" > and t3.app_user_id in <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> @@ -203,7 +201,7 @@ <select id="getNoInvoicedOrder" resultMap="BaseResultMap"> select * from t_shopping_order where del_flag = 0 and payment_status = 2 and status = 3 and app_user_id = #{appUserId} select * from t_shopping_order where del_flag = 0 and payment_status = 2 and status = 3 and app_user_id = #{appUserId} and refund_status is null <if test="null != month and '' != month"> and DATE_FORMAT(create_time, '%Y-%m') = #{month} </if> ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCouponController.java
@@ -118,7 +118,12 @@ for (ExchangeRecordVO record : data) { TCoupon byId = tCouponService.getById(record.getCouponId()); if (byId!=null){ if (byId.getDiscountAmount()!=null){ record.setDiscountAmount("¥"+byId.getDiscountAmount()); }else{ record.setDiscountAmount("¥"+byId.getMaximumDiscountAmount()); } if (Objects.equals(byId.getMeetTheConditions(), BigDecimal.ZERO)){ record.setMeetTheConditions("无门槛"); }else{ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -351,10 +351,11 @@ //调起支付 PaymentOrder paymentOrder = new PaymentOrder(); paymentOrder.setCode(shopOrder.getCode()); paymentOrder.setAmount(exchangeDto.getOrderPrice()); paymentOrder.setAmount(exchangeDto.getPayPrice()); paymentOrder.setOpenId(user.getWxOpenid()); paymentOrder.setDescription("购买商品"); R<Map<String, Object>> mapR = wxPaymentClient.orderPay(paymentOrder); mapR.getData().put("orderId",shopOrder.getId().toString()); return mapR; }else { //todo 罗 支付宝支付 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java
@@ -60,7 +60,6 @@ @Override public PageInfo<TGoods> pageList1(AppGoodQuery basePage) { GoodsDTO dto = new GoodsDTO(); dto.setType(2); dto.setStatus(1); dto.setPageCurr(basePage.getPageCurr()); dto.setPageSize(basePage.getPageSize()); @@ -81,7 +80,7 @@ } String string = stringBuilder.toString(); // 订单号加上商品类型 String res = string+"-"+dto.getType(); String res = string+"-"+basePage.getType(); List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); for (int i = 0; i < list.size(); i++) {