Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
1 文件已重命名
24个文件已修改
2个文件已添加
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "发送短信dto类") |
| | | public class SendMessageDTO implements Serializable { |
| | | |
| | | private String phone; |
| | | private String code; |
| | | private String site; |
| | | private String chargeGun; |
| | | private Integer type;// 1 codeMsg 2 applyCodeMsg 3 faultMsg |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | |
| | | public R<String> getWXToken() { |
| | | return R.fail("获取微信token失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> sensitiveWordDetection(String content, String openid) { |
| | | return R.fail("敏感词校验失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> sendMessage(SendMessageDTO sendMessageDTO) { |
| | | return R.fail("短信发送失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | |
| | | */ |
| | | @PostMapping("/wxLogin/getWXToken") |
| | | R<String> getWXToken(); |
| | | |
| | | /** |
| | | * 敏感词检测 |
| | | * @param content |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | @PostMapping("/wxLogin/sensitiveWordDetection") |
| | | R<Boolean> sensitiveWordDetection (@RequestParam("content") String content, @RequestParam("openid") String openid); |
| | | |
| | | /** |
| | | * 短信发送 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-user/sendMessage") |
| | | R<String> sendMessage(@RequestBody SendMessageDTO sendMessageDTO); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * <p>文件上传配置</p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/10/13 16:10 |
| | | */ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "file.upload") |
| | | public class FileUploadConfig { |
| | | private String accessPath; |
| | | private String allowExt; |
| | | private String location; |
| | | private String qrLocation; |
| | | } |
File was renamed from ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/FileController.java |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.ruoyi.chargingPile.config.FileUploadConfig; |
| | | import com.ruoyi.account.config.FileUploadConfig; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | } |
| | | String TimeDir =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| | | String realPath = fileUploadConfig.getLocation() + TimeDir; |
| | | // String realPath = "D:\\file\\" + TimeDir; |
| | | File file = new File(realPath); |
| | | // 没有目录就创建 |
| | | if (!file.exists()) { |
| | |
| | | mf.transferTo(targetFile); |
| | | //拼接数据 |
| | | String imgstr = fileUploadConfig.getAccessPath() + TimeDir +"/"+ filename; |
| | | // String imgstr = TimeDir +"/"+ filename; |
| | | return AjaxResult.success(imgstr); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.util.carBrand.CarBrandUtil; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import com.ruoyi.common.core.enums.status.AppUserStatusEnum; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.*; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | |
| | | appUserService.updateById(appUser); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/sendMessage") |
| | | public R<String> sendMessage(@RequestBody SendMessageDTO sendMessageDTO){ |
| | | switch (sendMessageDTO.getType()){ |
| | | case 1: |
| | | String reqStr1 = MsgUtil.codeMsg(sendMessageDTO.getPhone(), sendMessageDTO.getCode()); |
| | | String result1 = HttpUtils.post(MsgConstants.SEND_URL, reqStr1); |
| | | return R.ok(result1); |
| | | case 2: |
| | | String reqStr2 = MsgUtil.applyCodeMsg(sendMessageDTO.getPhone(), sendMessageDTO.getCode()); |
| | | String result2 = HttpUtils.post(MsgConstants.SEND_URL, reqStr2); |
| | | return R.ok(result2); |
| | | default: |
| | | String reqStr3 = MsgUtil.faultMsg(sendMessageDTO.getPhone(), sendMessageDTO.getSite(), sendMessageDTO.getChargeGun()); |
| | | String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); |
| | | return R.ok(result3); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alipay.api.internal.util.codec.Base64; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.FileUploadUtils; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | return R.ok(accessToken); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 敏感词检测 |
| | | * @param content |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | @PostMapping("/sensitiveWordDetection") |
| | | public R<Boolean> sensitiveWordDetection (@RequestParam("content") String content, @RequestParam("openid") String openid){ |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject(); |
| | | jsonObject.put("content", content); |
| | | jsonObject.put("version", 2); |
| | | jsonObject.put("scene", 2); |
| | | jsonObject.put("openid", openid); |
| | | String post = HttpUtils.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + accessToken, jsonObject.toString()); |
| | | com.alibaba.fastjson2.JSONObject object = com.alibaba.fastjson2.JSONObject.parseObject(post); |
| | | Integer errcode = object.getInteger("errcode"); |
| | | if(0 != errcode){ |
| | | throw new RuntimeException(object.getString("errmsg")); |
| | | } |
| | | JSONArray detail = object.getJSONArray("detail"); |
| | | for (int i = 0; i < detail.size(); i++) { |
| | | JSONObject jsonObject1 = detail.getJSONObject(i); |
| | | Integer errcode1 = jsonObject1.getInteger("errcode"); |
| | | if(0 == errcode1){ |
| | | String suggest = jsonObject1.getString("suggest"); |
| | | Integer label = jsonObject1.getInteger("label"); |
| | | String keyword = jsonObject1.getString("keyword"); |
| | | Integer prob = jsonObject1.getInteger("prob"); |
| | | if(("risky".equals(suggest) || "review".equals(suggest)) && 100 != label && StringUtils.isNotEmpty(keyword) && 80 <= prob){ |
| | | return R.ok(true); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(false); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.UPDATE_PHONE,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(phone); |
| | | sendMessageDTO.setCode(code); |
| | | sendMessageDTO.setType(1); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | // String reqStr = MsgUtil.codeMsg(phone, code); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | |
| | | { |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLY_CHARGING,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(phone); |
| | | sendMessageDTO.setCode(code); |
| | | sendMessageDTO.setType(2); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | // String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | | import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO; |
| | |
| | | import com.ruoyi.chargingPile.util.QRCodeUtils; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | StatusModeStatisticsVO statusModeStatistics1 = this.baseMapper.getStatusModeStatistics(siteIds,1); |
| | | StatusModeStatisticsVO statusModeStatistics2 = this.baseMapper.getStatusModeStatistics(siteIds,2); |
| | | StatusModeStatisticsVO statusModeStatistics3 = this.baseMapper.getStatusModeStatistics(siteIds,3); |
| | | if (statusModeStatistics1==null){ |
| | | StatusModeStatisticsVO vo = new StatusModeStatisticsVO(); |
| | | vo.setChargeMode(1); |
| | | vo.setFreeCount(0); |
| | | vo.setFilledCount(0); |
| | | vo.setInsertCount(0); |
| | | vo.setChargingCount(0); |
| | | statusModeStatistics1 =vo; |
| | | } |
| | | statusModeStatisticsVOS.add(statusModeStatistics1); |
| | | if (statusModeStatistics2==null){ |
| | | StatusModeStatisticsVO vo = new StatusModeStatisticsVO(); |
| | | vo.setChargeMode(2); |
| | | vo.setFreeCount(0); |
| | | vo.setFilledCount(0); |
| | | vo.setInsertCount(0); |
| | | vo.setChargingCount(0); |
| | | statusModeStatistics2 =vo; |
| | | } |
| | | statusModeStatisticsVOS.add(statusModeStatistics2); |
| | | |
| | | if (statusModeStatistics3==null){ |
| | | StatusModeStatisticsVO vo = new StatusModeStatisticsVO(); |
| | | vo.setChargeMode(3); |
| | | vo.setFreeCount(0); |
| | | vo.setFilledCount(0); |
| | | vo.setInsertCount(0); |
| | | vo.setChargingCount(0); |
| | | statusModeStatistics3 =vo; |
| | | } |
| | | statusModeStatisticsVOS.add(statusModeStatistics3); |
| | | gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatisticsVOS); |
| | | return gunStatusStatisticsVO; |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Override |
| | | public void add(TFaultMessage dto) { |
| | |
| | | Site site = siteService.getById(dto.getSiteId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | String siteName = site.getName(); |
| | | String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setCode(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | log.info("故障短信提醒:{}",result); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | Site site = siteService.getById(dto.getSiteId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | String siteName = site.getName(); |
| | | String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setCode(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | log.info("故障短信提醒:{}",result); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getCoupon") |
| | | public BaseResponse<GetCouponResp> getCoupon(GetCouponReq req){ |
| | | log.warn("停车获取优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | log.info("停车获取优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | GetCouponResp coupon = couponService.getCoupon(req); |
| | | log.info("停车获取优惠券结果:{}", JSON.toJSONString(coupon)); |
| | | return BaseResponse.ok(coupon); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/usedCoupon") |
| | | public BaseResponse usedCoupon(UsedCoupon req){ |
| | | log.warn("停车使用优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | log.info("停车使用优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | couponService.usedCoupon(req); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingInOrder") |
| | | public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){ |
| | | log.warn("云停车入场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("云停车入场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.cloudParkingInOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingOutOrder") |
| | | public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){ |
| | | log.warn("云停车出场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("云停车出场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.cloudParkingOutOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingSpace") |
| | | public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){ |
| | | log.warn("云停车实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | log.info("云停车实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | parkingOrderService.cloudParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingInOrder") |
| | | public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){ |
| | | log.warn("线下停车场入场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("线下停车场入场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.offlineParkingInOrder(order); |
| | | OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse(); |
| | | offlineParkingResponse.setCode(0); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingOutOrder") |
| | | public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){ |
| | | log.warn("线下停车场出场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("线下停车场出场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.offlineParkingOutOrder(order); |
| | | OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse(); |
| | | offlineParkingResponse.setCode(0); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingSpace") |
| | | public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){ |
| | | log.warn("线下停车场实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | log.info("线下停车场实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | parkingOrderService.offlineParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | }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; |
| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | |
| | | query.setLicensePlate(order.getPlate()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ISO_DATE_TIME); |
| | | parse = parse.plusHours(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | |
| | | TChargingOrder chargingOrder = data.get(0); |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | //超时占位费 |
| | | long out = parkingRecord.getOutParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond(); |
| | | long in = parkingRecord.getInParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond(); |
| | | long m = (out - in) / 60; |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | //超时占位费 |
| | | long out = parkingRecord.getOutParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond(); |
| | | long in = parkingRecord.getInParkingTime().atZone(ZoneId.systemDefault()).toEpochSecond(); |
| | | long m = (out - in) / 60; |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | } |
| | | } |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | Boolean success = jsonObject.getBoolean("success"); |
| | | if(!success){ |
| | | log.warn("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result); |
| | | log.info("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result); |
| | | } |
| | | return success; |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/securityDetection") |
| | | public void securityDetection(@RequestBody SecurityDetectionVO securityDetection){ |
| | | log.error("-------------------安全检测数据-------------------:" + securityDetection); |
| | | log.info("-------------------安全检测数据-------------------:" + securityDetection); |
| | | chargingOrderService.securityDetection(securityDetection); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/startChargeSuccessfully") |
| | | public void startChargeSuccessfully(@RequestBody PlatformStartChargingReplyMessageVO message){ |
| | | log.error("-------------------远程启动充电请求应答-------------------:" + message); |
| | | log.info("-------------------远程启动充电请求应答-------------------:" + message); |
| | | chargingOrderService.startChargeSuccessfully(message); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/terminateSuccessfulResponse") |
| | | public void terminateSuccessfulResponse(@RequestBody PlatformStopChargingReplyVO platformStopChargingReply){ |
| | | log.error("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); |
| | | log.info("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); |
| | | chargingOrderService.terminateSuccessfulResponse(platformStopChargingReply); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/endChargeBillingCharge") |
| | | public void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo){ |
| | | log.error("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | log.info("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | chargingOrderService.endChargeBillingCharge(vo); |
| | | } |
| | | |
| | |
| | | brands.add(objectMap.get("vehicle_brand").toString()); |
| | | } |
| | | |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand","其他"); |
| | | others.put("counts",count); |
| | | carBrandMap.add(others); |
| | | if (carBrandMap.size()>=5) { |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand", "其他"); |
| | | others.put("counts", count); |
| | | carBrandMap.add(others); |
| | | } |
| | | //本地车数量 |
| | | Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); |
| | | |
| | |
| | | */ |
| | | @PostMapping("/endCharge") |
| | | public void endCharge(@RequestParam("code") String code){ |
| | | log.error(code + ":-------------------充电桩自动结束充电-------------------"); |
| | | log.info(code + ":-------------------充电桩自动结束充电-------------------"); |
| | | chargingOrderService.endCharge(code, 2); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/excelEndCharge") |
| | | public void excelEndCharge(@RequestParam("code") String code){ |
| | | log.error(code + ":-------------------充电异常,停止充电-------------------"); |
| | | log.info(code + ":-------------------充电异常,停止充电-------------------"); |
| | | chargingOrderService.excelEndCharge(code); |
| | | } |
| | | |
| | |
| | | if(2 == addChargingOrder.getPaymentType()){ |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(chargingOrder.getCode()); |
| | | req.setTotalAmount(chargingOrder.getPaymentAmount().toString()); |
| | | req.setTotalAmount(addChargingOrder.getPaymentAmount().toString()); |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(appUser.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | |
| | | platformStartCharging.setCard_number(chargingOrder.getId().toString()); |
| | | platformStartCharging.setAccount_balance(account_balance); |
| | | |
| | | log.error(chargingOrder.getCode() + ":-------------------远程调起开始充电请求-------------------" + platformStartCharging.toString()); |
| | | log.info(chargingOrder.getCode() + ":-------------------远程调起开始充电请求-------------------" + platformStartCharging.toString()); |
| | | sendMessageClient.platformStartCharging(platformStartCharging); |
| | | //异步线程检测远程启动的应答结果。如果失败,则需要全额退款 |
| | | Long id = chargingOrder.getId(); |
| | |
| | | String code = chargingOrder.getCode(); |
| | | String key = "AQJC_" + chargingOrder.getChargingGunId(); |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); |
| | | log.error(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); |
| | | log.info(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); |
| | | if(data.size() != 0){ |
| | | PlatformStartChargingReply platformStartChargingReply = data.get(1); |
| | | Integer startup_result = platformStartChargingReply.getStartup_result(); |
| | |
| | | return true; |
| | | }else{ |
| | | Integer counter = boot_failed_map.get(code); |
| | | log.error(code + ":-------------------未上传开启充电结果-------------------" + counter); |
| | | log.info(code + ":-------------------未上传开启充电结果-------------------" + counter); |
| | | PreChargeCheck preChargeCheck1 = redisService.getCacheObject(key); |
| | | //5分钟内未启动成功,退回金额。 |
| | | if(null == counter || counter < 300){ |
| | |
| | | * @param code |
| | | */ |
| | | public void refund(String code){ |
| | | log.error(code + ":-------------------充电启动失败,执行退款-------------------"); |
| | | log.info(code + ":-------------------充电启动失败,执行退款-------------------"); |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, code)); |
| | | if(chargingOrder.getStatus() == 2){ |
| | | Integer rechargePaymentType = chargingOrder.getRechargePaymentType(); |
| | |
| | | platformStopCharging.setCharging_pile_code(chargingPile.getCode()); |
| | | platformStopCharging.setCharging_gun_code(chargingGun.getCode()); |
| | | sendMessageClient.platformStopCharging(platformStopCharging); |
| | | log.error(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.error(platformStopCharging.toString()); |
| | | log.info(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.info(platformStopCharging.toString()); |
| | | }); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | failure_cause = "其他"; |
| | | break; |
| | | } |
| | | log.error(code1 + ":停机失败:订单号:{},失败原因:{}", order.getCode(), failure_cause); |
| | | log.info(code1 + ":停机失败:订单号:{},失败原因:{}", order.getCode(), failure_cause); |
| | | }else{ |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | chargingOrder.setId(order.getId()); |
| | |
| | | } |
| | | } |
| | | } |
| | | //会员折扣金额 |
| | | discountAmount = discountAmount.setScale(2, RoundingMode.DOWN); |
| | | payAmount = payAmount.subtract(discountAmount); |
| | | |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setId(chargingOrder.getId()); |
| | | order.setAppUserId(chargingOrder.getAppUserId()); |
| | | if(null != chargingOrder.getEndMode() && chargingOrder.getEndMode() == 2){ |
| | | order.setEndMode(refundAmount.compareTo(BigDecimal.ZERO) > 0 ? 2 : 3); |
| | | } |
| | | if(null == chargingOrder.getEndMode()){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | if(null != uploadRealTimeMonitoringData && null == chargingOrder.getEndMode()){ |
| | | Integer soc = uploadRealTimeMonitoringData.getSoc(); |
| | | order.setEndMode(soc > 98 ? 2 : 3); |
| | | }else{ |
| | | order.setEndMode(1); |
| | | } |
| | | order.setResidualAmount(rechargeAmount.subtract(total).setScale(2, RoundingMode.DOWN)); |
| | |
| | | order.setEndTime(LocalDateTime.parse(vo.getEnd_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setStatus(5); |
| | | order.setOrderAmount(orderAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setVipDiscountAmount(discountAmount); |
| | | order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setChargingCapacity(vo.getTotal_electricity()); |
| | | order.setElectricity(vo.getTotal_electricity()); |
| | | |
| | | //计算优惠券 |
| | | BigDecimal couponDiscount = BigDecimal.ZERO; |
| | | if(null != chargingOrder.getAppCouponId()){ |
| | | //判断实际充电金额是否满足优惠券使用条件,如果不满足则不适用优惠券。 |
| | | TAppCoupon appCoupon = appCouponClient.getAppCouponById(chargingOrder.getAppCouponId()).getData(); |
| | |
| | | BigDecimal couponDiscountAmount = tCoupon.getDiscountAmount(); |
| | | //如果优惠金额大于服务费金额,以服务费作为最大限制 |
| | | if(periodServicePrice_total.compareTo(couponDiscountAmount) < 0){ |
| | | refundAmount = refundAmount.add(periodServicePrice_total); |
| | | order.setCouponDiscountAmount(periodServicePrice_total); |
| | | payAmount = payAmount.subtract(periodServicePrice_total); |
| | | couponDiscount = periodServicePrice_total; |
| | | periodServicePrice_total = BigDecimal.ZERO; |
| | | }else{ |
| | | refundAmount = refundAmount.add(couponDiscountAmount); |
| | | order.setCouponDiscountAmount(couponDiscountAmount); |
| | | payAmount = payAmount.subtract(couponDiscountAmount); |
| | | couponDiscount = couponDiscountAmount; |
| | | periodServicePrice_total = periodServicePrice_total.subtract(couponDiscountAmount); |
| | | } |
| | | |
| | | appCoupon.setStatus(2); |
| | | appCouponClient.updateAppCoupon(appCoupon); |
| | | }else{ |
| | |
| | | divide = divide.compareTo(tCoupon.getMaximumDiscountAmount()) > 0 ? tCoupon.getMaximumDiscountAmount() : divide; |
| | | //如果优惠金额大于服务费金额,以服务费作为最大限制 |
| | | if(periodServicePrice_total.compareTo(divide) < 0){ |
| | | refundAmount = refundAmount.add(periodServicePrice_total); |
| | | order.setCouponDiscountAmount(periodServicePrice_total); |
| | | payAmount = payAmount.subtract(periodServicePrice_total); |
| | | couponDiscount = periodServicePrice_total; |
| | | periodServicePrice_total = BigDecimal.ZERO; |
| | | }else{ |
| | | refundAmount = refundAmount.add(divide); |
| | | order.setCouponDiscountAmount(divide); |
| | | payAmount = payAmount.subtract(divide); |
| | | couponDiscount = divide; |
| | | periodServicePrice_total = periodServicePrice_total.subtract(divide); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //优惠券优惠金额 |
| | | couponDiscount = couponDiscount.setScale(2, RoundingMode.DOWN); |
| | | refundAmount = refundAmount.add(couponDiscount); |
| | | payAmount = payAmount.subtract(couponDiscount); |
| | | order.setCouponDiscountAmount(couponDiscount); |
| | | order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setPaymentAmount(payAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setRefundAmount(refundAmount.setScale(2, RoundingMode.DOWN)); |
| | |
| | | BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodServicePrice(); |
| | | BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(reduce, new MathContext(4, RoundingMode.HALF_EVEN))); |
| | | periodServicePrice = periodServicePrice.subtract(multiply); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice.setScale(2, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply.setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | chargingOrderAccountingStrategyService.updateBatchById(list); |
| | | } |
| | |
| | | //检测敏感词 |
| | | String content = orderEvaluate.getContent(); |
| | | if(StringUtils.isNotEmpty(content)){ |
| | | String token = appUserClient.getWXToken().getData(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("content", content); |
| | | jsonObject.put("version", 2); |
| | | jsonObject.put("scene", 2); |
| | | jsonObject.put("openid", appUser.getWxOpenid()); |
| | | String post = HttpUtils.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + token, jsonObject.toString()); |
| | | JSONObject object = JSONObject.parseObject(post); |
| | | Integer errcode = object.getInteger("errcode"); |
| | | if(0 != errcode){ |
| | | throw new RuntimeException(object.getString("errmsg")); |
| | | } |
| | | JSONArray detail = object.getJSONArray("detail"); |
| | | for (int i = 0; i < detail.size(); i++) { |
| | | JSONObject jsonObject1 = detail.getJSONObject(i); |
| | | Integer errcode1 = jsonObject1.getInteger("errcode"); |
| | | if(0 == errcode1){ |
| | | String suggest = jsonObject1.getString("suggest"); |
| | | Integer label = jsonObject1.getInteger("label"); |
| | | String keyword = jsonObject1.getString("keyword"); |
| | | Integer prob = jsonObject1.getInteger("prob"); |
| | | if(("risky".equals(suggest) || "review".equals(suggest)) && 100 != label && StringUtils.isNotEmpty(keyword) && 80 <= prob){ |
| | | return AjaxResult.error("评价包含违规内容,请重新评价!"); |
| | | } |
| | | } |
| | | Boolean data = appUserClient.sensitiveWordDetection(content, appUser.getWxOpenid()).getData(); |
| | | if(data){ |
| | | return AjaxResult.error("评价包含违规内容,请重新评价!"); |
| | | } |
| | | } |
| | | orderEvaluate.setContent(content); |
| | | this.save(orderEvaluate); |
| | | |
| | | List<Integer> tagIds = query.getTagIds(); |
| | | for (Integer tagId : tagIds) { |
| | | TOrderEvaluateTag orderEvaluateTag = new TOrderEvaluateTag(); |
| | | orderEvaluateTag.setOrderEvaluateId(orderEvaluate.getId()); |
| | | orderEvaluateTag.setEvaluationTagId(tagId); |
| | | orderEvaluateTagMapper.insert(orderEvaluateTag); |
| | | if(null != tagIds){ |
| | | for (Integer tagId : tagIds) { |
| | | TOrderEvaluateTag orderEvaluateTag = new TOrderEvaluateTag(); |
| | | orderEvaluateTag.setOrderEvaluateId(orderEvaluate.getId()); |
| | | orderEvaluateTag.setEvaluationTagId(tagId); |
| | | orderEvaluateTagMapper.insert(orderEvaluateTag); |
| | | } |
| | | } |
| | | |
| | | //判断发放积分 文字+图片+5星好评 |
| | |
| | | orderInvoiceDetail.setAddedServiceTariff(invoiceType.getAddedServiceTariff()); |
| | | orderInvoiceDetail.setElectrovalence(electrovalence); |
| | | orderInvoiceDetail.setServiceCharge(serviceCharge); |
| | | orderInvoiceDetail.setAddedService(serviceCharge.multiply(invoiceType.getAddedServiceTariff().divide(new BigDecimal(100)))); |
| | | orderInvoiceDetail.setAddedService(serviceCharge.multiply(null == invoiceType.getAddedServiceTariff() |
| | | ? new BigDecimal(1) : invoiceType.getAddedServiceTariff().divide(new BigDecimal(100)))); |
| | | orderInvoiceDetailService.save(orderInvoiceDetail); |
| | | } |
| | | return AjaxResult.success(); |
| | |
| | | select count(1) |
| | | from |
| | | charging_pile_account.t_app_user_car |
| | | where del_flag = 0 and vehicle_brand not in |
| | | where del_flag = 0 |
| | | |
| | | <if test="brands != null and brands.size() > 0"> |
| | | and vehicle_brand not in |
| | | <foreach collection="brands" item="brand" open="(" separator="," close=")"> |
| | | #{brand} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TGoodsService; |
| | | 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 io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品") |
| | | @PostMapping(value = "/app/pay") |
| | | public R<Map<String, Object>> pay(@RequestBody ExchangeDto exchangeDto) { |
| | | public Object pay(@RequestBody ExchangeDto exchangeDto) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | boolean isVip = false; |
| | |
| | | mapR.getData().put("orderId",shopOrder.getId().toString()); |
| | | return mapR; |
| | | }else { |
| | | //todo 罗 支付宝支付 |
| | | return R.ok(); |
| | | 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() + "/payment/callBack/ali/all"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
| | | public Object vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
| | | @RequestParam("payType") Integer payType |
| | | ) { |
| | | |
| | |
| | | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId)); |
| | | return vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | |
| | |
| | | PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize); |
| | | |
| | | |
| | | Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId); |
| | | Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType, BigDecimal discountMoney, BigDecimal discount, Integer buyType, Long userId); |
| | | } |
| | |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return wxPaymentClient.orderPay(paymentOrder).getData(); |
| | | return AjaxResult.success(wxPaymentClient.orderPay(paymentOrder).getData()); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | |
| | | req.setBody("充电充值"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all"); |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/payment/callBack/ali/all"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import com.ruoyi.payment.ali.v2.AppletPayUtil; |
| | | import com.ruoyi.payment.api.model.*; |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @ResponseBody |
| | | @PostMapping(value = "/allCallBack") |
| | | @PostMapping(value = "/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(); |
| | | // 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(); |
| | | // } |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | R r = orderClient.callBack(out_trade_no, transaction_id); |
| | | System.err.println("----收到购物回调"); |
| | | break; |
| | | case "HY": |
| | | orderClient.vipCallBack(out_trade_no,transaction_id); |
| | | System.err.println("----收到会员回调"); |
| | | break; |
| | | case "CD": |
| | | chargingOrderClient.chargingOrderWXCallback(out_trade_no, transaction_id, attach); |
| | | System.err.println("----充电支付回调"); |
| | | break; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |