Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
# Conflicts:
# ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
# ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
# ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
# ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
| | |
| | | public R<List<TAppUserCar>> getCarByIds(List<Long> carIds) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUserCar> getAppUserCarByLicensePlate(String licensePlate) { |
| | | return R.fail("根据车牌号查询数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds); |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号查询数据 |
| | | * @param licensePlate |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getAppUserCarByLicensePlate") |
| | | R<TAppUserCar> getAppUserCarByLicensePlate(@RequestParam("licensePlate") String licensePlate); |
| | | } |
| | |
| | | public R<BigDecimal> getRecordAmount(LocalDate sixBefore) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<TParkingLot> getParkingLotByAppKey(String appKey) { |
| | | return R.fail("根据停车场标识查询失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * 停车场服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ParkingRecordFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<ParkingRecordClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ParkingRecordFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ParkingRecordClient create(Throwable throwable) { |
| | | log.error("停车记录调用失败:{}", throwable.getMessage()); |
| | | return new ParkingRecordClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<TParkingRecord> getParkingRecord(GetParkingRecord query) { |
| | | return R.fail("根据车牌和状态查询停车数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void updateParkingRecord(TParkingRecord parkingRecord) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public R<TParkingRecord> getParkingRecordById(Long id) { |
| | | return R.fail("根据id获取数失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void addParkingRecord(TParkingRecord parkingRecord) { |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | @PostMapping(value = "/t-parking-lot/getRecordAmount") |
| | | public R<BigDecimal> getRecordAmount(@RequestParam("sixBefore") LocalDate sixBefore); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据停车场标识查询停车场 |
| | | * @param appKey |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-parking-lot/getParkingLotByAppKey") |
| | | R<TParkingLot> getParkingLotByAppKey(@RequestParam("appKey") String appKey); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 14:05 |
| | | */ |
| | | @FeignClient(contextId = "ParkingRecordClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ParkingRecordFallbackFactory.class) |
| | | public interface ParkingRecordClient { |
| | | |
| | | |
| | | /** |
| | | * 根据车牌和状态查询停车数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-parking-record/getParkingRecord") |
| | | R<TParkingRecord> getParkingRecord(@RequestBody GetParkingRecord query); |
| | | |
| | | |
| | | /** |
| | | * 修改停车数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/t-parking-record/updateParkingRecord") |
| | | void updateParkingRecord(@RequestBody TParkingRecord parkingRecord); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-parking-record/getParkingRecordById") |
| | | R<TParkingRecord> getParkingRecordById(@RequestParam("id") Long id); |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/t-parking-record/addParkingRecord") |
| | | void addParkingRecord(@RequestBody TParkingRecord parkingRecord); |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "车牌号") |
| | | @TableField("license_plate") |
| | | private String licensePlate; |
| | | |
| | | @TableField(exist = false) |
| | | private String name; |
| | | |
| | | @TableField(exist = false) |
| | | |
| | | private String uid; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "超时占位费") |
| | | @TableField("timeout_amount") |
| | | private BigDecimal timeoutAmount; |
| | | |
| | | @ApiModelProperty(value = "电话") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "免费时长(分钟)") |
| | | @TableField("free_duration") |
| | | private Integer freeDuration; |
| | | |
| | | @ApiModelProperty(value = "免费金额") |
| | | @TableField("free_amount") |
| | | private BigDecimal freeAmount; |
| | | |
| | | @ApiModelProperty(value = "车场流水号") |
| | | @TableField("serialnumber") |
| | | private String serialnumber; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 14:16 |
| | | */ |
| | | @Data |
| | | public class GetParkingRecord { |
| | | /** |
| | | * 车牌 |
| | | */ |
| | | private String licensePlate; |
| | | /** |
| | | * 状态(1=已进场,2=已出场,3=已缴费出场) |
| | | */ |
| | | private Integer status; |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory |
| | |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingOrder> getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query) { |
| | | return R.fail("根据车牌号和时间查询有效的充电数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TSettlementConfirm> downloadSettlement(String uid) { |
| | | return R.fail("通过id查询结算确认失败:" + throwable.getMessage()); |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.slf4j.Logger; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> addVipOrder(TVipOrder vipOrder) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TShoppingOrder> shopCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("订单创建" + cause.getMessage()); |
| | | } |
| | |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @PostMapping("/t-charging-order/excelEndCharge") |
| | | void excelEndCharge(@RequestParam("code") String code); |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和时间查询有效的充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-charging-order/getChargingOrderByLicensePlate") |
| | | R<TChargingOrder> getChargingOrderByLicensePlate(@RequestBody GetChargingOrderByLicensePlate query); |
| | | |
| | | /** |
| | | * 获取充电结算记录 |
| | | * @param uid |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-vip-order//addVipOrder") |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder vipOrder); |
| | | @PostMapping("/t-shopping-order/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-shopping-order/callBack") |
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_charging_order_refund") |
| | | @ApiModel(value="TChargingOrderRefund对象", description="") |
| | | @ApiModel(value="TChargingOrderRefund对象1", description="") |
| | | public class TChargingOrderRefund implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @TableField("pay_amount") |
| | | private BigDecimal payAmount; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | @ApiModelProperty(value = "第三方支付流水号") |
| | | @TableField(exist = false) |
| | | private String serailNumber; |
| | | @ApiModelProperty(value = "支付金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "支付时间") |
| | | @TableField(exist = false) |
| | | private LocalDateTime payTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 14:25 |
| | | */ |
| | | @Data |
| | | public class GetChargingOrderByLicensePlate { |
| | | /** |
| | | * 车牌 |
| | | */ |
| | | private String licensePlate; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | |
| | | } |
| | |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.auth.form.LoginBody; |
| | | import com.ruoyi.auth.form.RegisterBody; |
| | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token", tokenService.createToken(userInfo)); |
| | | List<SysRole> roles = userInfo.getSysUser().getRoles(); |
| | | // if(CollectionUtils.isEmpty(roles)){ |
| | | // return R.fail("请关联角色!"); |
| | | // } |
| | | if(CollectionUtils.isEmpty(roles)){ |
| | | return R.fail("请关联角色!"); |
| | | } |
| | | |
| | | // map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("info", userInfo); |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | |
| | | public LoginUserApplet getLoginUserApplet() { |
| | | LoginUserApplet loginUserAppletToken = getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | if (loginUserAppletToken == null) { |
| | | throw new UserAppletException("登录失效,请重新登录!", 401); |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUserAppletToken; |
| | | } |
| | |
| | | * @return 用户信息 |
| | | */ |
| | | public LoginUser getLoginUser() { |
| | | return getLoginUser(ServletUtils.getRequest()); |
| | | LoginUser loginUser = getLoginUser(ServletUtils.getRequest()); |
| | | if (loginUser == null) { |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUser; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | public void refreshToken1(LoginUserApplet dto) { |
| | | dto.setLoginTime(System.currentTimeMillis()); |
| | | dto.setExpireTime(dto.getLoginTime() + expireTime * MILLIS_MINUTE); |
| | | dto.setExpireTime(dto.getLoginTime() + expireAppletTime * MILLIS_MINUTE); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(dto.getToken()); |
| | | redisService.setCacheObject(userKey, dto, expireTime, TimeUnit.MINUTES); |
| | | redisService.setCacheObject(userKey, dto, expireAppletTime, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | private String getTokenKey(String token) { |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds){ |
| | | return R.ok(appUserCarService.list(Wrappers.lambdaQuery(TAppUserCar.class).in(TAppUserCar::getId,carIds))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号查询数据 |
| | | * @param licensePlate |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getAppUserCarByLicensePlate") |
| | | public R<TAppUserCar> getAppUserCarByLicensePlate(@RequestParam("licensePlate") String licensePlate){ |
| | | TAppUserCar one = appUserCarService.getOne(new LambdaQueryWrapper<TAppUserCar>().eq(TAppUserCar::getLicensePlate, licensePlate).eq(TAppUserCar::getDelFlag, 0)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | byId.setAuditStatus(3); |
| | | byId.setTwoRemark(steategyPassDto.getRemark()); |
| | | byId.setTwoAuditTime(LocalDateTime.now()); |
| | | |
| | | //如果parentId不为空,则将parentId对应的siteId改为现在的,并且将parenId对应的数据删除 |
| | | |
| | | |
| | | //将site表对应的模板id修改为新的这个 |
| | | |
| | | } |
| | | }else { |
| | | byId.setAuditStatus(4); |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TParkingLotDTO; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | |
| | | BigDecimal sum = parkingRecordService.getSum(sixBefore); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据停车场标识查询停车场 |
| | | * @param appKey |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getParkingLotByAppKey") |
| | | public R<TParkingLot> getParkingLotByAppKey(@RequestParam("appKey") String appKey){ |
| | | TParkingLot parkingLot = parkingLotService.getOne(new LambdaQueryWrapper<TParkingLot>() |
| | | .eq(TParkingLot::getAppKey, appKey).eq(TParkingLot::getDelFlag, 0)); |
| | | return R.ok(parkingLot); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordPageQuery; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "详情") |
| | | @GetMapping(value = "/detail") |
| | | public R<TParkingRecord> detail(Long id) { |
| | | |
| | | return R.ok(parkingRecordService.getById(id)); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "出场") |
| | | @GetMapping(value = "/out") |
| | | public R out(Long id) { |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据车牌和状态查询停车数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/getParkingRecord") |
| | | public R<TParkingRecord> getParkingRecord(@RequestBody GetParkingRecord query){ |
| | | TParkingRecord one = parkingRecordService.getOne(new LambdaQueryWrapper<TParkingRecord>() |
| | | .eq(TParkingRecord::getLicensePlate, query.getLicensePlate()).eq(TParkingRecord::getStatus, query.getStatus())); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改停车数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/updateParkingRecord") |
| | | public void updateParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.updateById(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getParkingRecordById") |
| | | public R<TParkingRecord> getParkingRecordById(@RequestParam("id") Long id){ |
| | | TParkingRecord parkingRecord = parkingRecordService.getById(id); |
| | | return R.ok(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/addParkingRecord") |
| | | public void addParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.save(parkingRecord); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.controller; |
| | | |
| | | import com.ruoyi.integration.barrierGate.model.BaseResponse; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponReq; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponResp; |
| | | import com.ruoyi.integration.barrierGate.model.UsedCoupon; |
| | | import com.ruoyi.integration.barrierGate.server.CouponService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 优惠券控制器 |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/coupon") |
| | | public class CouponController { |
| | | |
| | | @Resource |
| | | private CouponService couponService; |
| | | |
| | | |
| | | /** |
| | | * 获取优惠券 |
| | | * 减免停车费的优惠 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getCoupon") |
| | | public BaseResponse<GetCouponResp> getCoupon(@RequestBody GetCouponReq req){ |
| | | GetCouponResp coupon = couponService.getCoupon(req); |
| | | return BaseResponse.ok(coupon); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用优惠券 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/usedCoupon") |
| | | public BaseResponse usedCoupon(@RequestBody UsedCoupon req){ |
| | | couponService.usedCoupon(req); |
| | | return BaseResponse.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.controller; |
| | | |
| | | import com.ruoyi.integration.barrierGate.model.*; |
| | | import com.ruoyi.integration.barrierGate.server.ParkingOrderService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:14 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/parkingOrder") |
| | | public class ParkingOrderController { |
| | | |
| | | @Resource |
| | | private ParkingOrderService parkingOrderService; |
| | | |
| | | |
| | | /** |
| | | * 云停车入场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingInOrder") |
| | | public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){ |
| | | parkingOrderService.cloudParkingInOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车出场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingOutOrder") |
| | | public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){ |
| | | parkingOrderService.cloudParkingOutOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingSpace") |
| | | public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){ |
| | | parkingOrderService.cloudParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 线下停车场入场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingInOrder") |
| | | public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){ |
| | | parkingOrderService.offlineParkingInOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场出场 |
| | | * @param order |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingOutOrder") |
| | | public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){ |
| | | parkingOrderService.offlineParkingOutOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingSpace") |
| | | public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){ |
| | | parkingOrderService.offlineParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:29 |
| | | */ |
| | | @Data |
| | | public class BaseResponse<T> { |
| | | |
| | | private String code; |
| | | |
| | | private String msg; |
| | | |
| | | private T data; |
| | | |
| | | |
| | | public static BaseResponse ok(){ |
| | | return ok(new Object()); |
| | | } |
| | | |
| | | |
| | | public static <T> BaseResponse<T> ok(T data){ |
| | | BaseResponse baseResponse = new BaseResponse(); |
| | | baseResponse.setCode("0"); |
| | | baseResponse.setData(data); |
| | | baseResponse.setMsg("成功"); |
| | | return baseResponse; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 云停车订单实体 |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 15:54 |
| | | */ |
| | | @Data |
| | | public class CloudParkingOrder { |
| | | /** |
| | | * 停车场appKey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 车场业务ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 入场通道号 |
| | | */ |
| | | private String enterChannel; |
| | | /** |
| | | * 入场时间 |
| | | */ |
| | | private String enterDateTime; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String plate; |
| | | /** |
| | | * 入场通道名称 |
| | | */ |
| | | private String enterChannelName; |
| | | /** |
| | | * 车牌颜色 |
| | | */ |
| | | private String plateColor; |
| | | /** |
| | | * 卡种类 |
| | | */ |
| | | private String kind; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 应收金额 |
| | | */ |
| | | private String receivable; |
| | | /** |
| | | * 实收金额 |
| | | */ |
| | | private String payment; |
| | | /** |
| | | * 支付方式 |
| | | */ |
| | | private String payType; |
| | | /** |
| | | * 离场通道号 |
| | | */ |
| | | private String leaveChannel; |
| | | /** |
| | | * 离场时间 |
| | | */ |
| | | private String leaveDateTime; |
| | | /** |
| | | * 离场通道名称 |
| | | */ |
| | | private String leaveChannelName; |
| | | /** |
| | | * 停车时长 |
| | | */ |
| | | private String longTime; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:22 |
| | | */ |
| | | @Data |
| | | public class CloudParkingSpace { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 总车位数 |
| | | */ |
| | | private String total; |
| | | /** |
| | | * 已用车位 |
| | | */ |
| | | private String used; |
| | | /** |
| | | * 空余车位 |
| | | */ |
| | | private String free; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:12 |
| | | */ |
| | | @Data |
| | | public class GetCouponReq { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appKey; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carNumber; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 停车费用 |
| | | */ |
| | | private String fee; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:19 |
| | | */ |
| | | @Data |
| | | public class GetCouponResp { |
| | | /** |
| | | * 优惠券记录id |
| | | */ |
| | | private Long recordId; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carNumber; |
| | | /** |
| | | * 平台编号 |
| | | */ |
| | | private String sysOrgId; |
| | | /** |
| | | * 商户名称 |
| | | */ |
| | | private String posName; |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | /** |
| | | * 发放人 |
| | | */ |
| | | private String lssuer; |
| | | /** |
| | | * 类型:1单次全免、2金额优惠、3单笔折扣、4优惠时长、5日期范围全免 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 优惠明细 |
| | | */ |
| | | private Parameter parameter; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 云停车订单实体 |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 15:54 |
| | | */ |
| | | @Data |
| | | public class OfflineParkingOrder { |
| | | /** |
| | | * 停车场appKey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 10 位时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 进出记录 ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 卡号 |
| | | */ |
| | | private String cardid; |
| | | /** |
| | | * 会员 ID |
| | | */ |
| | | private String memberid; |
| | | /** |
| | | * 会员类型 |
| | | */ |
| | | private String membertype; |
| | | /** |
| | | * 会员姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String platenumber; |
| | | /** |
| | | * 车牌颜色 |
| | | */ |
| | | private String platecolor; |
| | | /** |
| | | * 入场通道 |
| | | */ |
| | | private String enterchannel; |
| | | /** |
| | | * 入场时间 |
| | | */ |
| | | private String entertime; |
| | | /** |
| | | * 是否库中库 0、不是库中库,1、是库中库 |
| | | */ |
| | | private Integer subplace; |
| | | /** |
| | | * 抓拍图片(base64) |
| | | */ |
| | | private String image; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | /** |
| | | * 停车时长(分钟) |
| | | */ |
| | | @JsonProperty("long") |
| | | private String longTime; |
| | | /** |
| | | * 停车费用 |
| | | */ |
| | | private String money; |
| | | /** |
| | | * 出场通道 |
| | | */ |
| | | private String leavechannel; |
| | | /** |
| | | * 出场时间 |
| | | */ |
| | | private String leavetime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:22 |
| | | */ |
| | | @Data |
| | | public class OfflineParkingSpace { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appkey; |
| | | /** |
| | | * 10 位时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 总车位数 |
| | | */ |
| | | private Integer place; |
| | | /** |
| | | * 剩余车位数 |
| | | */ |
| | | private Integer surplus; |
| | | /** |
| | | * 固定车数量 |
| | | */ |
| | | private Integer fixed; |
| | | /** |
| | | * 临时车数量 |
| | | */ |
| | | private Integer interim; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:24 |
| | | */ |
| | | @Data |
| | | public class Parameter { |
| | | /** |
| | | * 使用门槛 |
| | | */ |
| | | private Boolean isHaveUseRequirement; |
| | | /** |
| | | * 金额优惠满减阈值 |
| | | */ |
| | | private Double minAmount; |
| | | /** |
| | | * 时长优惠满减阈值 |
| | | */ |
| | | private Double minRequirement; |
| | | /** |
| | | * 全免标记 |
| | | */ |
| | | private Boolean freeFlag; |
| | | /** |
| | | * 优惠折扣 |
| | | */ |
| | | private Double discount; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | private Double money; |
| | | /** |
| | | * 优惠时长 |
| | | */ |
| | | private Integer time; |
| | | /** |
| | | * 开始日期 yyyy-mm-dd HH:mm:ss #日期范围开始 |
| | | */ |
| | | private String startTime; |
| | | /** |
| | | * 结束日期 yyyy-mm-dd HH:mm:ss #日期范围开始 |
| | | */ |
| | | private String endTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 15:39 |
| | | */ |
| | | @Data |
| | | public class UsedCoupon { |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appKey; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | | private String carNumber; |
| | | /** |
| | | * 车场流水号 |
| | | */ |
| | | private String serialnumber; |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String timestamp; |
| | | /** |
| | | * 未优惠停车费用 |
| | | */ |
| | | private String fee; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | private String actualFee; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | private String recordId; |
| | | /** |
| | | * 平台编号 |
| | | */ |
| | | private String sysOrgId; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponReq; |
| | | import com.ruoyi.integration.barrierGate.model.GetCouponResp; |
| | | import com.ruoyi.integration.barrierGate.model.Parameter; |
| | | import com.ruoyi.integration.barrierGate.model.UsedCoupon; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 11:11 |
| | | */ |
| | | @Service |
| | | public class CouponService { |
| | | |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | |
| | | @Resource |
| | | private ParkingRecordClient parkingRecordClient; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取优惠券 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | public GetCouponResp getCoupon(GetCouponReq req){ |
| | | //根据车牌查询入场时间,后再根据入场时间和车牌查询是否有充电订单 |
| | | String carNumber = req.getCarNumber(); |
| | | String appKey = req.getAppKey(); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(appKey).getData(); |
| | | if(null == parkingLot){ |
| | | return null; |
| | | } |
| | | GetParkingRecord query = new GetParkingRecord(); |
| | | query.setStatus(1); |
| | | query.setLicensePlate(carNumber); |
| | | TParkingRecord data = parkingRecordClient.getParkingRecord(query).getData(); |
| | | if(null == data){ |
| | | return null; |
| | | } |
| | | //入场时间 |
| | | LocalDateTime inParkingTime = data.getInParkingTime(); |
| | | //开始查询充电订单 |
| | | GetChargingOrderByLicensePlate getChargingOrderByLicensePlate = new GetChargingOrderByLicensePlate(); |
| | | getChargingOrderByLicensePlate.setLicensePlate(carNumber); |
| | | getChargingOrderByLicensePlate.setStartTime(inParkingTime); |
| | | TChargingOrder tChargingOrder = chargingOrderClient.getChargingOrderByLicensePlate(getChargingOrderByLicensePlate).getData(); |
| | | |
| | | GetCouponResp resp = new GetCouponResp(); |
| | | resp.setRecordId(data.getId()); |
| | | resp.setCarNumber(carNumber); |
| | | // todo 需要第三方提供数据 |
| | | resp.setSysOrgId(""); |
| | | resp.setPosName(""); |
| | | resp.setLssuer("admin"); |
| | | resp.setType(4); |
| | | Parameter parameter = new Parameter(); |
| | | parameter.setFreeFlag(false); |
| | | if(null == tChargingOrder){ |
| | | //按照非充电进行优惠计算 |
| | | resp.setCouponName("普通停车时长优惠"); |
| | | parameter.setTime(parkingLot.getNonChargeFreeDuration()); |
| | | data.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | }else{ |
| | | resp.setCouponName("充电停车时长优惠"); |
| | | parameter.setTime(parkingLot.getChargeFreeDuration()); |
| | | data.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | data.setChargingOrderId(tChargingOrder.getId()); |
| | | data.setAppUserId(tChargingOrder.getAppUserId()); |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | } |
| | | resp.setParameter(parameter); |
| | | return resp; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用优惠券 |
| | | * @param req |
| | | */ |
| | | public void usedCoupon(UsedCoupon req){ |
| | | TParkingRecord data = parkingRecordClient.getParkingRecordById(Long.valueOf(req.getRecordId())).getData(); |
| | | data.setSerialnumber(req.getSerialnumber()); |
| | | data.setFreeAmount(new BigDecimal(req.getActualFee())); |
| | | data.setOrderAmount(new BigDecimal(req.getFee())); |
| | | BigDecimal subtract = data.getOrderAmount().subtract(data.getFreeAmount()); |
| | | if(BigDecimal.ZERO.compareTo(subtract) < 0){ |
| | | data.setTimeoutAmount(subtract); |
| | | data.setOutParkingType(1); |
| | | data.setStatus(3); |
| | | }else{ |
| | | data.setTimeoutAmount(BigDecimal.ZERO); |
| | | data.setOutParkingType(2); |
| | | data.setStatus(2); |
| | | } |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingSpace; |
| | | import com.ruoyi.integration.barrierGate.model.OfflineParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.model.OfflineParkingSpace; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/5 16:15 |
| | | */ |
| | | @Service |
| | | public class ParkingOrderService { |
| | | |
| | | @Resource |
| | | private ParkingRecordClient parkingRecordClient; |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 云停车入场记录 |
| | | * @param order |
| | | */ |
| | | public void cloudParkingInOrder(CloudParkingOrder order) { |
| | | TParkingRecord parkingRecord = new TParkingRecord(); |
| | | parkingRecord.setLicensePlate(order.getPlate()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); |
| | | parkingRecord.setCode(code); |
| | | parkingRecord.setVehicleColor(order.getPlateColor()); |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setParkingLotId(data.getId()); |
| | | parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEnterDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setStatus(1); |
| | | parkingRecord.setCreateTime(LocalDateTime.now()); |
| | | parkingRecord.setSerialnumber(order.getId()); |
| | | parkingRecordClient.addParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车出场记录 |
| | | * @param order |
| | | */ |
| | | public void cloudParkingOutOrder(CloudParkingOrder order) { |
| | | GetParkingRecord query = new GetParkingRecord(); |
| | | query.setLicensePlate(order.getPlate()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getReceivable())); |
| | | BigDecimal payment = new BigDecimal(order.getPayment()); |
| | | parkingRecord.setStatus(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 3); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 云停车实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | public void cloudParkingSpace(CloudParkingSpace parkingSpace){ |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场入场记录 |
| | | * @param order |
| | | */ |
| | | public void offlineParkingInOrder(OfflineParkingOrder order) { |
| | | TParkingRecord parkingRecord = new TParkingRecord(); |
| | | parkingRecord.setLicensePlate(order.getPlatenumber()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = "TC" + Math.random() * 1000 + sdf.format(new Date()); |
| | | parkingRecord.setCode(code); |
| | | parkingRecord.setVehicleColor(order.getPlatecolor()); |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setParkingLotId(data.getId()); |
| | | parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEntertime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setStatus(1); |
| | | parkingRecord.setCreateTime(LocalDateTime.now()); |
| | | parkingRecord.setSerialnumber(order.getId()); |
| | | parkingRecordClient.addParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场出场记录 |
| | | * @param order |
| | | */ |
| | | public void offlineParkingOutOrder(OfflineParkingOrder order) { |
| | | GetParkingRecord query = new GetParkingRecord(); |
| | | query.setLicensePlate(order.getPlatenumber()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getMoney())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 线下停车场实时车位 |
| | | * @param parkingSpace |
| | | */ |
| | | public void offlineParkingSpace(OfflineParkingSpace parkingSpace){ |
| | | |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String sk; |
| | | /** |
| | | * endpoint配置 938d8d39e2.iotda.cn-north-4.myhuaweicloud.com |
| | | * endpoint配置 94cb3eb5f9.st1.iotda-app.cn-south-1.myhuaweicloud.com |
| | | */ |
| | | private String endpoint; |
| | | /** |
| | | * project_id配置 0cc59978c61e4b4da24e8c3d02937b45 |
| | | * project_id配置 f31c21e190e04fb0aebf8c0b1e7959cd |
| | | */ |
| | | private String projectId; |
| | | /** |
| | | * Instance-Id配置 c60f266a-57a2-460c-a24e-eabda84602eb |
| | | * Instance-Id配置 d21a37d3-c578-43aa-a1ab-be3854e7c337 |
| | | */ |
| | | private String instanceId; |
| | | |
| | |
| | | import com.huaweicloud.sdk.core.exception.ServiceResponseException; |
| | | import com.huaweicloud.sdk.iam.v3.model.*; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.iotda.builder.IotBuilder; |
| | | import com.ruoyi.integration.iotda.config.IotAccountConfig; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.iotda.utils.time.UtcToSeconds; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
New file |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/callBack") |
| | | public class CallBackController { |
| | | |
| | | @Resource |
| | | private TVipOrderService tVipOrderService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/ali/all") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | |
| | | break; |
| | | case "HY": |
| | | tVipOrderService.payBack(out_trade_no); |
| | | break; |
| | | } |
| | | |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.GetNoInvoicedOrder; |
| | |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | @ApiOperation(value = "退款", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R refund(@RequestBody PayOrderRefundDto payOrderQueryDto) { |
| | | return chargingOrderService.payRefund(payOrderQueryDto); |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund/list") |
| | | @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-退款订单"}) |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-退款订单"}) |
| | | public R<PageInfo<TChargingOrderRefund>> refundList(@RequestBody ChargingRefundDto chargingRefundDto) { |
| | | return chargingOrderService.getRefundList(chargingRefundDto); |
| | | |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund/list1") |
| | | @ApiOperation(value = "列表1", tags = {"管理后台-支付订单-退款订单"}) |
| | | public R<PageInfo<TChargingOrderRefund>> refundList1(@RequestBody ChargingRefundDto chargingRefundDto) { |
| | | return chargingOrderService.getRefundList(chargingRefundDto); |
| | | |
| | | } |
| | |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getMyChargingOrderList") |
| | | @ApiOperation(value = "获取充电记录列表", tags = {"小程序-充电记录"}) |
| | |
| | | |
| | | return resultList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 硬件充电结束后的处理逻辑 |
| | | * @param code |
| | |
| | | public void endCharge(@RequestParam("code") String code){ |
| | | chargingOrderService.endCharge(code, 2); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 硬件异常结束充电后的处理逻辑 |
| | | * @param code |
| | |
| | | public void excelEndCharge(@RequestParam("code") String code){ |
| | | chargingOrderService.excelEndCharge(code); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和时间查询有效的充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/getChargingOrderByLicensePlate") |
| | | public R<TChargingOrder> getChargingOrderByLicensePlate(@RequestBody GetChargingOrderByLicensePlate query){ |
| | | TChargingOrder chargingOrder = chargingOrderService.getChargingOrderByLicensePlate(query); |
| | | return R.ok(chargingOrder); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | |
| | | } |
| | | @PostMapping("/addVipOrder") |
| | | @ApiOperation(value = "添加会员订单", tags = {"管理后台-会员订单"}) |
| | | public AjaxResult addVipOrder(@RequestBody TVipOrder dto) { |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder dto) { |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return AjaxResult.success(); |
| | | return R.ok(dto.getId()); |
| | | } |
| | | @GetMapping("/deleteVipOrder") |
| | | @ApiOperation(value = "批量删除会员订单", tags = {"管理后台-会员订单"}) |
| | |
| | | import com.ruoyi.order.api.query.SettlementListQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | |
| | | */ |
| | | void excelEndCharge(String orderCode); |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和开始时间查询充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | TChargingOrder getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query); |
| | | |
| | | |
| | | TSettlementConfirm settlementAdd(SettlementConfirmAdd dto); |
| | | |
| | | PageInfo<TSettlementConfirm> settlementList(SettlementListQuery dto); |
| | |
| | | List<SixVipDto> sixBefore(LocalDate sixBefore); |
| | | |
| | | BigDecimal getSumAmout(LocalDate sixBefore); |
| | | |
| | | void payBack(String outTradeNo); |
| | | } |
| | |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.query.SettlementListQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.api.vo.*; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.mapper.TSettlementConfirmMapper; |
| | |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private TSettlementConfirmMapper tSettlementConfirmMapper; |
| | | |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | |
| | | @Resource |
| | | private AppCouponClient appCouponClient; |
| | | |
| | |
| | | chargingOrder.setVipDiscountAmount(discountAmount); |
| | | } |
| | | } |
| | | |
| | | } |
| | | this.save(chargingOrder); |
| | | |
| | |
| | | preChargeCheck1.setFailureCause(failure_cause); |
| | | //启动失败后取消订单,退款操作 |
| | | refund(code); |
| | | order.setStatus(5); |
| | | order.setStatus(-1); |
| | | order.setEndMode(0); |
| | | }else{ |
| | | preChargeCheck1.setStartupSuccess(2); |
| | |
| | | return chargingOrderTimeVO; |
| | | } |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | return null; |
| | | } |
| | | // @Override |
| | | // public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | // return null; |
| | | // } |
| | | |
| | | @Override |
| | | public ChargingOrderListInfoVO chargingInfo(String uid) { |
| | |
| | | chargingOrderListInfoVO.setList1(list); |
| | | return chargingOrderListInfoVO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | |
| | | endCharge(orderCode, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | if (payOrderQueryDto.getType()==1){ |
| | | TChargingOrder tChargingOrder = this.baseMapper.selectById(payOrderQueryDto.getOrderId()); |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(tChargingOrder.getRechargePaymentType()); |
| | | chargingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefund.setCode(tChargingOrder.getCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Math.random() * 1000)); |
| | | chargingOrderRefund.setRefundTitle("后台退款"); |
| | | chargingOrderRefund.setRefundContent("后台退款"); |
| | | chargingOrderRefund.setRefundReason("后台退款"); |
| | | chargingOrderRefund.setRefundRemark("后台退款"); |
| | | chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); |
| | | chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); |
| | | |
| | | if(1 == tChargingOrder.getRechargePaymentType()){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(tChargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getRechargeSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://127.0.0.1:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setCurrency("CNY"); |
| | | model.setAmount(amount); |
| | | R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | if(200 == orderR.getCode()){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | |
| | | if(2 == tChargingOrder.getRechargePaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和开始时间查询充电数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TChargingOrder getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query) { |
| | | TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(query.getLicensePlate()).getData(); |
| | | if(null == appUserCar){ |
| | | return null; |
| | | } |
| | | 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)); |
| | | return one; |
| | | } |
| | | |
| | | @Override |
| | | public TSettlementConfirm settlementAdd(SettlementConfirmAdd dto) { |
| | | List<Site> data = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData(); |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | |
| | | public BigDecimal getSumAmout(LocalDate sixBefore) { |
| | | return this.baseMapper.getSumAmout(sixBefore); |
| | | } |
| | | |
| | | @Override |
| | | public void payBack(String outTradeNo) { |
| | | //将vip订单改为已完成 |
| | | TVipOrder tVipOrder = this.baseMapper.selectOne(Wrappers.lambdaQuery(TVipOrder.class).eq(TVipOrder::getCode, outTradeNo)); |
| | | tVipOrder.setPaymentStatus(2); |
| | | this.baseMapper.updateById(tVipOrder); |
| | | //赠送会员 |
| | | GiveVipDto giveVipDto = new GiveVipDto(); |
| | | giveVipDto.setUserIds(tVipOrder.getAppUserId().toString()); |
| | | giveVipDto.setVipId(tVipOrder.getVipId()); |
| | | giveVipDto.setType(tVipOrder.getVipType()); |
| | | // vipClient.giveVip(giveVipDto); |
| | | } |
| | | } |
| | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | | |
| | | select * from (SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_charging_order_refund |
| | | UNION ALL |
| | | SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_shopping_order_refund |
| | | UNION ALL |
| | | SELECT id, |
| | | `code`, |
| | | refund_code, |
| | | refund_title, |
| | | refund_reason, |
| | | refund_amount, |
| | | refund_total_amount, |
| | | refund_time, |
| | | pay_type, |
| | | pay_amount, |
| | | refund_remark |
| | | FROM t_vip_order_refund) o |
| | | select * from (SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.pay_time |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | | SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.pay_time |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | | SELECT vr.id, |
| | | vr.`code`, |
| | | vr.refund_code, |
| | | vr.refund_title, |
| | | vr.refund_reason, |
| | | vr.refund_amount, |
| | | vr.refund_total_amount, |
| | | vr.refund_time, |
| | | vr.pay_type, |
| | | vr.pay_amount, |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.pay_time |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | | |
| | | ) o |
| | | <where> |
| | | <if test="data.code != null and data.code != ''"> |
| | | AND o.code LIKE CONCAT('%',#{data.code},'%') |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | |
| | | private TVipService vipService; |
| | | @Resource |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | public AjaxResult saveVip(@RequestBody TVip dto) { |
| | |
| | | return R.ok(vipInfoDtos); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam(name = "1月2季3年",value = "buyType") Integer buyType, |
| | | @RequestParam(name = "1微信2支付宝",value = "payType") Integer payType |
| | | ) { |
| | | |
| | | TVip byId = vipService.getById(vipId); |
| | | BigDecimal payMoney = BigDecimal.ZERO; |
| | | BigDecimal discountMoney = BigDecimal.ZERO; |
| | | BigDecimal discount = BigDecimal.ZERO; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | switch (buyType){ |
| | | case 1: |
| | | if (byId.getMonthlyCardDiscountStart()!=null&&(now.isAfter(byId.getMonthlyCardDiscountStart())&&now.isBefore(byId.getMonthlyCardDiscountEnd()))){ |
| | | payMoney = byId.getMonthlyCard().multiply(byId.getMonthlyCardDiscount()); |
| | | discountMoney = byId.getMonthlyCard().subtract(payMoney); |
| | | discount = byId.getMonthlyCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getMonthlyCard(); |
| | | } |
| | | break; |
| | | case 2: |
| | | if (byId.getSeasonCardDiscountStart()!=null&&(now.isAfter(byId.getSeasonCardDiscountStart())&&now.isBefore(byId.getSeasonCardDiscountEnd()))){ |
| | | payMoney = byId.getSeasonCard().multiply(byId.getSeasonCardDiscount()); |
| | | discountMoney = byId.getSeasonCard().subtract(payMoney); |
| | | discount = byId.getSeasonCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getSeasonCard(); |
| | | } |
| | | break; |
| | | case 3: |
| | | if (byId.getAnnualCardDiscountStart()!=null&&(now.isAfter(byId.getAnnualCardDiscountStart())&&now.isBefore(byId.getAnnualCardDiscountEnd()))){ |
| | | payMoney = byId.getAnnualCard().multiply(byId.getAnnualCardDiscount()); |
| | | discountMoney = byId.getAnnualCard().subtract(payMoney); |
| | | discount = byId.getAnnualCardDiscount(); |
| | | }else { |
| | | payMoney = byId.getAnnualCard(); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize); |
| | | |
| | | |
| | | Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.mapper.TCouponMapper; |
| | | import com.ruoyi.other.mapper.TVipMapper; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private TCouponMapper tCouponMapper; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize) { |
| | | PageInfo<TVip> pageInfo = new PageInfo<>(pageCurr,pageSize); |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId) { |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | //生成会员购买订单 |
| | | |
| | | TVipOrder shopOrder = new TVipOrder(); |
| | | shopOrder.setCode(OrderCodeUtil.getOrderCode("HY")); |
| | | shopOrder.setAppUserId(userId); |
| | | shopOrder.setType(1); |
| | | shopOrder.setVipId(byId.getId()); |
| | | shopOrder.setVipType(buyType); |
| | | shopOrder.setOrderAmount(payMoney.add(discountMoney)); |
| | | shopOrder.setDiscount(discount); |
| | | shopOrder.setDiscountAmount(discountMoney); |
| | | shopOrder.setPaymentAmount(payMoney); |
| | | shopOrder.setPaymentStatus(1); |
| | | shopOrder.setPaymentType(payType); |
| | | shopOrder.setPayTime(LocalDateTime.now()); |
| | | orderClient.addVipOrder(shopOrder).getData(); |
| | | |
| | | |
| | | if (payType==1){ |
| | | //调起支付 |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setCode(shopOrder.getCode()); |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return wxPaymentClient.orderPay(paymentOrder); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | | req.setTotalAmount(shopOrder.getPaymentAmount().toString()); |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(user.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.payment.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import com.ruoyi.payment.ali.v2.AppletPayUtil; |
| | | import com.ruoyi.payment.api.model.*; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto){ |
| | | return R.ok(appletPayUtil.refund(dto)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/allCallBack") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | log.info("支付回调:{}", params); |
| | | String outRefundNo = (String) params.get("out_refund_no"); |
| | | String out_trade_no = params.get("out_trade_no").toString(); |
| | | String substring = outRefundNo.substring(0, 2); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | |
| | | break; |
| | | case "HY": |
| | | break; |
| | | } |
| | | |
| | | return R.ok(params); |