ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/SendMessageDTO.java
New file @@ -0,0 +1,18 @@ 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 } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java
@@ -1,6 +1,7 @@ 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; @@ -91,6 +92,17 @@ 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()); } }; } } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -1,6 +1,7 @@ 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; @@ -93,4 +94,20 @@ */ @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); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
@@ -129,6 +129,11 @@ } @Override public void chargingOrderALICallback(String out_trade_no, String transaction_id, String attach) { log.error("充电支付成功回调通知失败:" + throwable.getMessage()); } @Override public void chargingOrderStartupFailureWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { log.error("远程启动失败后退款通知失败:" + throwable.getMessage()); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
@@ -153,6 +153,17 @@ /** * 充电支付成功回调通知 * @param out_trade_no * @param transaction_id * @param attach */ @PostMapping("/t-charging-order/chargingOrderALICallback") void chargingOrderALICallback(@RequestParam("out_trade_no") String out_trade_no, @RequestParam("transaction_id") String transaction_id, @RequestParam("attach") String attach); /** * 远程启动失败后退款回调 * @param out_refund_no * @param refund_id ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/feignClient/AliPaymentClient.java
@@ -11,6 +11,7 @@ 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 @@ -26,7 +27,7 @@ * @return */ @PostMapping("/ali/payment") R<AliPaymentResp> payment(AliPaymentReq req); R<AliPaymentResp> payment(@RequestBody AliPaymentReq req); /** @@ -35,14 +36,14 @@ * @return */ @PostMapping("/ali/query") R<AliQueryOrder> query(String outTradeNo); R<AliQueryOrder> query(@RequestParam("outTradeNo") String outTradeNo); /** * 关闭订单 * @param outTradeNo */ @PostMapping("/ali/close") void close(String outTradeNo); void close(@RequestParam("outTradeNo") String outTradeNo); /** * 后台退款 远程调用 */ ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/model/PaymentReq.java
@@ -41,6 +41,10 @@ * 如果请求时传递了该参数,支付宝会在异步通知时将该参数原样返回。 */ private String passbackParams; /** * 支付回调通知 */ private String notifyUrl; /** * 初始化默认数据 ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/AliPaymentReq.java
@@ -42,6 +42,10 @@ */ private String passbackParams; /** * 支付回调通知 */ private String notifyUrl; /** * 初始化默认数据 */ public AliPaymentReq() { ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/AliPaymentResp.java
@@ -16,9 +16,5 @@ */ @ApiModelProperty("支付单号") private String tradeNo; /** * 回调通知地址 */ @ApiModelProperty("回调通知地址") private String notifyUrl; private String orderId; } ruoyi-auth/src/main/resources/bootstrap.yml
@@ -6,8 +6,8 @@ spring: profiles: # 环境配置 active: dev # active: prod # active: dev active: prod application: # 应用名称 name: ruoyi-auth @@ -56,52 +56,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 # nacos注册中心地址 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # nacos注册中心地址 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 ruoyi-gateway/src/main/resources/bootstrap.yml
@@ -12,8 +12,8 @@ allow-bean-definition-overriding: true profiles: # 环境配置 active: dev # active: prod # active: dev active: prod --- spring: config: ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -13,6 +13,7 @@ import com.ruoyi.chargingPile.api.feignClient.SiteClient; import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.feignClient.RoleSiteClient; import com.ruoyi.other.api.feignClient.UserSiteClient; import com.ruoyi.system.api.query.ChangeUserQuery; @@ -89,6 +90,9 @@ @Resource private ISysRoleService sysRoleService; @Resource private TokenService tokenService; /** @@ -235,7 +239,8 @@ */ @Override public void checkUserAllowed(SysUser user) { if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) { Long userid = tokenService.getLoginUser().getUserid(); if (StringUtils.isNotNull(user.getUserId()) && !userid.equals(user.getUserId()) && user.isAdmin()) { throw new ServiceException("不允许操作超级管理员用户"); } } ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml
@@ -11,7 +11,8 @@ allow-bean-definition-overriding: true profiles: # 环境配置 active: dev # active: dev active: prod --- spring: config: @@ -54,52 +55,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 # nacos注册中心地址 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # nacos注册中心地址 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/config/FileUploadConfig.java
New file @@ -0,0 +1,21 @@ 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; } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/FileController.java
File was renamed from ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/FileController.java @@ -1,6 +1,6 @@ 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; @@ -37,7 +37,6 @@ } 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()) { @@ -57,7 +56,6 @@ mf.transferTo(targetFile); //拼接数据 String imgstr = fileUploadConfig.getAccessPath() + TimeDir +"/"+ filename; // String imgstr = TimeDir +"/"+ filename; return AjaxResult.success(imgstr); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -16,12 +16,11 @@ 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; @@ -1183,5 +1182,24 @@ 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); } } } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WxLoginController.java
@@ -1,6 +1,7 @@ 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; @@ -18,6 +19,7 @@ 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; @@ -179,4 +181,43 @@ 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); } } ruoyi-service/ruoyi-account/src/main/resources/bootstrap.yml
@@ -12,8 +12,8 @@ allow-circular-references: true profiles: # 环境配置 active: dev # active: prod # active: dev active: prod --- spring: config: @@ -56,52 +56,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 # nacos注册中心地址 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # nacos注册中心地址 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 192.168.0.137:8080 # Sentinel控制台地址 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java
@@ -1,5 +1,6 @@ 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; @@ -48,8 +49,13 @@ } 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); @@ -67,8 +73,13 @@ { 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); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
@@ -1,8 +1,6 @@ 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; @@ -10,7 +8,6 @@ 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; @@ -23,14 +20,11 @@ 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; @@ -40,13 +34,11 @@ 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> ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
@@ -306,8 +306,36 @@ 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; ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TFaultMessageServiceImpl.java
@@ -2,6 +2,8 @@ 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; @@ -63,6 +65,8 @@ @Resource private SysUserRoleClient sysUserRoleClient; @Resource private AppUserClient appUserClient; @Override public void add(TFaultMessage dto) { @@ -70,8 +74,14 @@ 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); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -68,6 +68,18 @@ } List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo); for (TParkingRecordVO tParkingRecordVO : list) { if (tParkingRecordVO.getParkingDuration()==null){ tParkingRecordVO.setFeeDuration(0); }else if(tParkingRecordVO.getFreeDuration()==null){ tParkingRecordVO.setFeeDuration(tParkingRecordVO.getParkingDuration()); }else{ tParkingRecordVO.setFeeDuration(tParkingRecordVO.getParkingDuration()-tParkingRecordVO.getFreeDuration()); } tParkingRecordVO.setOrderAmount(tParkingRecordVO.getOrderAmount()!=null?tParkingRecordVO.getOrderAmount():new BigDecimal("0") .add(tParkingRecordVO.getTimeoutAmount()!=null?tParkingRecordVO.getTimeoutAmount():new BigDecimal("0"))); tParkingRecordVO.setParkingFee(tParkingRecordVO.getOrderAmount()); } pageInfo.setRecords(list); // 查询总数 TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query); ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TRepairServiceImpl.java
@@ -1,6 +1,8 @@ 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; @@ -64,7 +66,9 @@ @Resource private SysUserRoleClient sysUserRoleClient; @Resource private AppUserClient appUserClient; @@ -108,8 +112,14 @@ 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); ruoyi-service/ruoyi-chargingPile/src/main/resources/bootstrap.yml
@@ -12,7 +12,8 @@ allow-circular-references: true profiles: # 环境配置 active: dev # active: dev active: prod --- spring: config: @@ -55,52 +56,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml
@@ -30,7 +30,7 @@ <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordVO"> select tpr.id, tpr.code,tpr.app_user_id, tpr.license_plate, tpr.vehicle_color, tpr.charging_order_id, tpr.parking_lot_id, tpr.in_parking_time, tpr.out_parking_time, tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount - tpr.timeout_amount) as parkingFee,tpr.timeout_amount, tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount + tpr.timeout_amount) as parkingFee,tpr.timeout_amount, tpr.free_duration,(tpr.parking_duration - tpr.free_duration) as feeDuration,ts.name as siteName from t_parking_record tpr left join t_parking_lot tpl on tpr.parking_lot_id = tpl.id ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/CouponController.java
@@ -34,8 +34,9 @@ @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); } @@ -48,7 +49,7 @@ @ResponseBody @PostMapping("/usedCoupon") public BaseResponse usedCoupon(UsedCoupon req){ log.warn("停车使用优惠券请求参数:{}", JSON.toJSONString(req)); log.info("停车使用优惠券请求参数:{}", JSON.toJSONString(req)); couponService.usedCoupon(req); return BaseResponse.ok(); } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/controller/ParkingOrderController.java
@@ -28,7 +28,7 @@ @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(); } @@ -41,7 +41,7 @@ @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(); } @@ -54,7 +54,7 @@ @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(); } @@ -67,7 +67,7 @@ @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); @@ -84,7 +84,7 @@ @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); @@ -101,7 +101,7 @@ @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(); } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/model/GetCouponReq.java
@@ -11,7 +11,7 @@ /** * 停车场appkey */ private String appKey; private String appkey; /** * 车牌号 */ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/model/UsedCoupon.java
@@ -11,7 +11,7 @@ /** * 停车场appkey */ private String appKey; private String appkey; /** * 车牌号 */ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/CouponService.java
@@ -47,7 +47,7 @@ public GetCouponResp getCoupon(GetCouponReq req){ //根据车牌查询入场时间,后再根据入场时间和车牌查询是否有充电订单 String carNumber = req.getCarNumber(); String appKey = req.getAppKey(); String appKey = req.getAppkey(); TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(appKey).getData(); if(null == parkingLot){ return null; @@ -70,7 +70,7 @@ GetCouponResp resp = new GetCouponResp(); resp.setRecordId(data.getId()); resp.setCarNumber(carNumber); resp.setSysOrgId("MXCD7QjHapTJGZ8TZZz3"); resp.setSysOrgId("MXCD0001"); resp.setPosName("明星电力"); resp.setLssuer("admin"); resp.setType(4); @@ -85,10 +85,6 @@ }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; ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java
@@ -1,6 +1,8 @@ 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; @@ -19,6 +21,7 @@ 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; @@ -41,6 +44,9 @@ @Resource private ChargingOrderClient chargingOrderClient; @Resource private AppUserClient appUserClient; @@ -79,6 +85,7 @@ 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); @@ -98,8 +105,19 @@ 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 m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); }else{ parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); 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); } @@ -146,9 +164,8 @@ query.setLicensePlate(order.getPlatenumber()); query.setStatus(1); TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); LocalDateTime parse = LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ISO_DATE_TIME); parse = parse.plusHours(8); parkingRecord.setOutParkingTime(parse); TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); parkingRecord.setOutParkingTime(LocalDateTime.now()); parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); parkingRecord.setOrderAmount(new BigDecimal(order.getMoney())); parkingRecord.setPayment(new BigDecimal(order.getMoney())); @@ -164,8 +181,19 @@ 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 m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); }else{ parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); 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); } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/SwitchwayGateService.java
@@ -36,7 +36,7 @@ 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; } ruoyi-service/ruoyi-integration/src/main/resources/bootstrap.yml
@@ -12,15 +12,9 @@ allow-circular-references: true profiles: # 环境配置 active: dev # active: prod --- spring: cloud: stream: rocketmq: binder: name-server: 127.0.0.1:9876 # active: dev active: prod --- spring: config: @@ -63,52 +57,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 # nacos注册中心地址 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # nacos注册中心地址 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/CallBackController.java
File was deleted ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
@@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import com.alibaba.nacos.shaded.com.google.common.collect.Maps; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.ruoyi.chargingPile.api.feignClient.SiteClient; import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.common.core.domain.R; @@ -64,7 +65,80 @@ private SiteClient siteClient; @Resource private TChargingOrderService chargingOrderService; @Resource private TChargingOrderRefundService tChargingOrderRefundService; @Resource private TChargingBillService tChargingBillService; @GetMapping(value = "/test") public R accountAdd() { // List<TChargingBill> list = tChargingBillService.lambdaQuery().list(); // for (TChargingBill tChargingBill : list) { // tChargingBill.setStatus(2); // } // tChargingBillService.updateBatchById(list); // List<TChargingOrder> list = chargingOrderService.lambdaQuery().list(); // for (TChargingOrder chargingOrder : list) { // chargingOrder.setSharingAmount(new BigDecimal("0")); // List<TChargingOrderRefund> list1 = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, chargingOrder.getId()).list(); // tChargingOrderRefundService.removeBatchByIds(list1); // chargingOrderService.removeById(chargingOrder); // } // chargingOrderService.updateBatchById(list); // TChargingBill tChargingBill = new TChargingBill(); // Random random = new Random(); // String randomDigits = random.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 // .mapToObj(String::valueOf) // .collect(Collectors.joining()); // 将其连接成一个字符串 // tChargingBill.setCode("JSD"+randomDigits ); // tChargingBill.setType(1); // tChargingBill.setSiteId(0); // tChargingBill.setBillTime(LocalDateTime.now().plusDays(1)); // tChargingBill.setStatus(1); // tChargingBill.setOrderState(2); // tChargingBill.setBillType(1); // chargingBillService.save(tChargingBill); // TChargingBill tChargingBill1 = new TChargingBill(); // Random random1 = new Random(); // String randomDigits1 = random1.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 // .mapToObj(String::valueOf) // .collect(Collectors.joining()); // 将其连接成一个字符串 // tChargingBill1.setCode("JSD"+randomDigits1); // tChargingBill1.setType(2); // tChargingBill1.setSiteId(13); // tChargingBill1.setBillTime(LocalDateTime.now().plusDays(1)); // tChargingBill1.setStatus(1); // tChargingBill1.setOrderState(2); // tChargingBill1.setBillType(1); // chargingBillService.save(tChargingBill1); // // TChargingBill tChargingBil3 = new TChargingBill(); // Random random2 = new Random(); // String randomDigits2 = random2.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 // .mapToObj(String::valueOf) // .collect(Collectors.joining()); // 将其连接成一个字符串 // tChargingBil3.setCode("JSD"+randomDigits2 ); // tChargingBil3.setType(1); // tChargingBil3.setSiteId(0); // tChargingBil3.setBillTime(LocalDateTime.now().plusDays(1)); // tChargingBil3.setStatus(1); // tChargingBil3.setOrderState(2); // tChargingBil3.setBillType(2); // chargingBillService.save(tChargingBil3); // TChargingBill tChargingBill14 = new TChargingBill(); // Random random3 = new Random(); // String randomDigits3 = random3.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 // .mapToObj(String::valueOf) // .collect(Collectors.joining()); // 将其连接成一个字符串 // tChargingBill14.setCode("JSD"+randomDigits3); // tChargingBill14.setType(2); // tChargingBill14.setSiteId(13); // tChargingBill14.setBillTime(LocalDateTime.now().plusDays(1)); // tChargingBill14.setStatus(1); // tChargingBill14.setOrderState(2); // tChargingBill14.setBillType(2); // chargingBillService.save(tChargingBill14); return R.ok(); } @PostMapping(value = "/accountBillList") @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"}) public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) { @@ -72,8 +146,7 @@ ChargingBillVO res = chargingBillService.chargingBillList1(dto); List<ChargingBillListVO> records = res.getList().getRecords(); accountListVO.setBillCount(records.size()); accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getRefundAmount()) .subtract(res.getCommissionAmount().setScale(2,BigDecimal.ROUND_DOWN)).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getRefundAmount()).subtract(res.getCommissionAmount()).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); accountListVO.setPaymentAmount(res.getPaymentAmount().setScale(2, BigDecimal.ROUND_DOWN)); accountListVO.setRefundAmount(res.getRefundAmount().setScale(2, BigDecimal.ROUND_DOWN)); accountListVO.setCommissionAmount(res.getCommissionAmount().setScale(2, BigDecimal.ROUND_DOWN)); @@ -231,8 +304,6 @@ } } @Autowired private TChargingOrderRefundService tChargingOrderRefundService; @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) @PutMapping("/download") public void download(@RequestBody ExportUidDto uid) @@ -285,6 +356,7 @@ BigDecimal paymentAmount = new BigDecimal("0"); BigDecimal refundAmount = new BigDecimal("0"); BigDecimal commissionAmount = new BigDecimal("0"); BigDecimal sharingAmount = new BigDecimal("0"); List<TChargingOrder> tChargingOrders = chargingOrderService.list(eq); // 累加支付金额 @@ -294,8 +366,9 @@ int i =1; for (TChargingOrder tChargingOrder : tChargingOrders) { // 账单信息 paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(bigDecimal1)); paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(bigDecimal1).setScale(2, BigDecimal.ROUND_DOWN)); sharingAmount = sharingAmount.add(tChargingOrder.getSharingAmount()!=null?tChargingOrder.getSharingAmount():new BigDecimal("0")); // 退款信息 ChargingBillRefundExport chargingBillRefundExport = new ChargingBillRefundExport(); ChargingBillPayExport chargingBillPayExport = new ChargingBillPayExport(); @@ -339,11 +412,11 @@ chargingBillPayExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); chargingBillPayExport.setCode(tChargingOrder.getCode()); chargingBillPayExport.setPayTime(tChargingOrder.getPayTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime())):""); chargingBillPayExport.setPaymentAmount(tChargingOrder.getChargeAmount().toString()); chargingBillPayExport.setPaymentAmount(tChargingOrder.getRechargeAmount().toString()); chargingBillPayExport.setTotal(""); chargingBillPayExports.add(chargingBillPayExport); i++; bigDecimal = bigDecimal.add(tChargingOrder.getChargeAmount()); bigDecimal = bigDecimal.add(tChargingOrder.getRechargeAmount()); } if (!chargingBillPayExports.isEmpty()){ chargingBillPayExports.get(0).setTotal(bigDecimal+""); @@ -359,7 +432,8 @@ } chargingBillExport.setPaymentAmount(paymentAmount); chargingBillExport.setRefundAmount(refundAmount); chargingBillExport.setIncome(paymentAmount.subtract(refundAmount).subtract(commissionAmount).setScale(2, BigDecimal.ROUND_DOWN)); chargingBillExport.setIncome(paymentAmount.subtract(refundAmount).subtract(commissionAmount) .subtract(sharingAmount).setScale(2, BigDecimal.ROUND_DOWN)); chargingBillExports.add(chargingBillExport); // 导出 List<Map<String, Object>> sheetsList = new ArrayList<>(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -526,7 +526,7 @@ @ResponseBody @PostMapping(value = "/securityDetection") public void securityDetection(@RequestBody SecurityDetectionVO securityDetection){ log.error("-------------------安全检测数据-------------------:" + securityDetection); log.info("-------------------安全检测数据-------------------:" + securityDetection); chargingOrderService.securityDetection(securityDetection); } @@ -537,7 +537,7 @@ @ResponseBody @PostMapping(value = "/startChargeSuccessfully") public void startChargeSuccessfully(@RequestBody PlatformStartChargingReplyMessageVO message){ log.error("-------------------远程启动充电请求应答-------------------:" + message); log.info("-------------------远程启动充电请求应答-------------------:" + message); chargingOrderService.startChargeSuccessfully(message); } @@ -548,21 +548,10 @@ */ @ResponseBody @PostMapping(value = "/chargingOrderALICallback") 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(); } public void chargingOrderALICallback(@RequestParam("out_trade_no") String out_trade_no, @RequestParam("transaction_id") String transaction_id, @RequestParam("attach") String attach) { chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); } @@ -625,7 +614,7 @@ */ @PostMapping("/terminateSuccessfulResponse") public void terminateSuccessfulResponse(@RequestBody PlatformStopChargingReplyVO platformStopChargingReply){ log.error("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); log.info("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); chargingOrderService.terminateSuccessfulResponse(platformStopChargingReply); } @@ -636,7 +625,7 @@ */ @PostMapping("/endChargeBillingCharge") public void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo){ log.error("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); log.info("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); chargingOrderService.endChargeBillingCharge(vo); } @@ -1280,11 +1269,13 @@ 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(); @@ -1804,7 +1795,7 @@ */ @PostMapping("/endCharge") public void endCharge(@RequestParam("code") String code){ log.error(code + ":-------------------充电桩自动结束充电-------------------"); log.info(code + ":-------------------充电桩自动结束充电-------------------"); chargingOrderService.endCharge(code, 2); } @@ -1814,7 +1805,7 @@ */ @PostMapping("/excelEndCharge") public void excelEndCharge(@RequestParam("code") String code){ log.error(code + ":-------------------充电异常,停止充电-------------------"); log.info(code + ":-------------------充电异常,停止充电-------------------"); chargingOrderService.excelEndCharge(code); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -154,6 +154,7 @@ List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq); int chargingSecond = 0; BigDecimal paymentAmount = new BigDecimal("0"); BigDecimal rechargeAmount = new BigDecimal("0"); BigDecimal orderAmount = new BigDecimal("0"); BigDecimal electrovalence = new BigDecimal("0"); BigDecimal serviceCharge = new BigDecimal("0"); @@ -265,7 +266,7 @@ if (data3!=null)tChargingOrder.setUserName(data3.getName()); // 累加实收金额 支付结算金额 if (tChargingOrder.getChargeAmount()!=null){ paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); } // 总金额 if (tChargingOrder.getOrderAmount()!=null){ @@ -274,6 +275,9 @@ // 累加累计电费 if (tChargingOrder.getElectrovalence()!=null){ electrovalence = electrovalence.add(tChargingOrder.getElectrovalence()); } if (tChargingOrder.getRechargeAmount()!=null){ rechargeAmount = rechargeAmount.add(tChargingOrder.getRechargeAmount()); } List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); @@ -288,7 +292,8 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006)) .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -311,7 +316,7 @@ chargingBillVO.setPaymentAmount(BigDecimal.ZERO); } chargingBillListVO.setPaymentAmount(paymentAmount); chargingBillListVO.setPaymentAmount(rechargeAmount); chargingBillListVO.setOrderAmount(paymentAmount == null?BigDecimal.ZERO:orderAmount.subtract(sharingAmount).subtract(commissionAmount)); chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount); chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); @@ -319,7 +324,7 @@ chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)); chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount); chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity); chargingBillListVO.setBillMoney(paymentAmount.subtract(refundAmount==null?BigDecimal.ZERO:refundAmount) chargingBillListVO.setBillMoney(rechargeAmount.subtract(refundAmount==null?BigDecimal.ZERO:refundAmount) .subtract(commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)).subtract(sharingAmount).setScale(2, BigDecimal.ROUND_DOWN)); switch (chargingBillListVO.getType()){ case 1: @@ -378,7 +383,7 @@ chargingBillVO.setExportList(tChargingOrders); for (TChargingOrder tChargingOrder : tChargingOrders) { if (tChargingOrder.getOrderAmount()!=null){ paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount()); paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getRechargeAmount()); } // 累加订单金额 @@ -405,7 +410,8 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -473,7 +479,7 @@ BigDecimal sharingAmountTotal = new BigDecimal("0"); BigDecimal chargingCapacityTotal = new BigDecimal("0"); BigDecimal discountTotal = new BigDecimal("0"); BigDecimal refundAmount = new BigDecimal("0"); BigDecimal refundAmountTotal = new BigDecimal("0"); int orderCount = 0; for (ChargingBillListVO chargingBillListVO : list) { String temp = ""; @@ -532,6 +538,7 @@ BigDecimal commissionAmount = new BigDecimal("0"); BigDecimal sharingAmount = new BigDecimal("0"); BigDecimal chargingCapacity = new BigDecimal("0"); BigDecimal refundAmount = new BigDecimal("0"); chargingBillVO.setCategory(""); chargingBillListVO.setOrderCount(tChargingOrders.size()); chargingBillVO.setExportList(tChargingOrders); @@ -638,8 +645,8 @@ paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); } // 总金额 if (tChargingOrder.getOrderAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); if (tChargingOrder.getRechargeAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount()); } // 累加累计电费 if (tChargingOrder.getElectrovalence()!=null){ @@ -654,7 +661,8 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006)) .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -672,9 +680,9 @@ // 格式化为字符串 String timeString = String.format("%d小时%d分钟%d秒", hours, minutes, seconds); chargingBillVO.setChargingTime(timeString); chargingBillListVO.setOrderAmount(orderAmount.subtract(refundAmount)); chargingBillListVO.setPaymentAmount(orderAmount.subtract(commissionAmount).subtract(sharingAmount).setScale(2,BigDecimal.ROUND_DOWN)); chargingBillListVO.setOrderAmount(orderAmount); chargingBillListVO.setPaymentAmount(chargingBillListVO.getOrderAmount().subtract(commissionAmount).subtract(sharingAmount).setScale(2,BigDecimal.ROUND_DOWN)); chargingBillListVO.setElectrovalence(electrovalence); chargingBillListVO.setServiceCharge(serviceCharge.setScale(2,BigDecimal.ROUND_DOWN)); chargingBillListVO.setCommissionAmount(commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)); @@ -697,7 +705,7 @@ chargingBillListVO.setChargingSecond(chargingSecond); } for (ChargingBillListVO chargingBillListVO : list1) { if (chargingBillListVO.getType() ==1){ if (chargingBillListVO.getType() ==2){ continue; } LocalDateTime billTime = chargingBillListVO.getBillTime(); @@ -746,9 +754,9 @@ paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); } // 累加订单金额 if (tChargingOrder.getOrderAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); orderAmountTotal = orderAmountTotal.add(tChargingOrder.getPaymentAmount()); if (tChargingOrder.getRechargeAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount()); orderAmountTotal = orderAmountTotal.add(tChargingOrder.getRechargeAmount()); } // 累加累计电费 if (tChargingOrder.getElectrovalence()!=null){ @@ -756,7 +764,7 @@ electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); } if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus() !=null && tChargingOrder.getRefundStatus() == 2){ refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); refundAmountTotal = refundAmountTotal.add(tChargingOrder.getRefundAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -765,8 +773,9 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")).setScale(2,BigDecimal.ROUND_DOWN)); commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) .setScale(2,BigDecimal.ROUND_DOWN)); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -788,8 +797,8 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); chargingBillVO.setPaymentAmount(orderAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setPaymentAmount(paymentAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setOrderAmount(orderAmountTotal.subtract(refundAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, BigDecimal.ROUND_DOWN)); chargingBillVO.setOrderCount(orderCount); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -524,13 +524,13 @@ 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("充电充值"); req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ data.setNotifyUrl(data.getNotifyUrl() + "/order/t-charging-order/chargingOrderALICallback"); return AjaxResult.success(data); } } @@ -671,7 +671,7 @@ 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(); @@ -699,7 +699,7 @@ 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(); @@ -741,7 +741,7 @@ 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){ @@ -837,7 +837,7 @@ * @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(); @@ -882,8 +882,7 @@ dto.setRefundReason("充电失败,取消充电订单"); RefundResp resp = aliPaymentClient.refund(dto).getData(); if(null != resp){ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); if(success.isSuccess()){ chargingOrderRefundService.save(chargingOrderRefund); } @@ -957,16 +956,12 @@ Integer h = Integer.valueOf(data.getCumulative_charging_time() / 60); Integer m = Integer.valueOf(data.getCumulative_charging_time() % 60); chargingDetails.setChargedTime(String.format("%02d", h) + ":" + String.format("%02d", m)); } //转换成UTC时间 ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData(); if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){ BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity(); TAppUserCar appUserCar = appUserCarClient.getCarByIds(Arrays.asList(one.getAppUserCarId())).getData().get(0); // 续航 = 电池容量 / 续航里程 * soc BigDecimal divide = bms_battery_capacity.divide(new BigDecimal(appUserCar.getEndurance())); BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(divide); chargingDetails.setEndurance(multiply); if(null != one.getAppUserCarId()){ TAppUserCar appUserCar = appUserCarClient.getCarById(one.getAppUserCarId().toString()).getData(); // 续航 = 续航里程 * soc BigDecimal multiply = new BigDecimal(data.getSoc()).divide(new BigDecimal(100)).multiply(new BigDecimal(appUserCar.getEndurance())); chargingDetails.setEndurance(multiply.setScale(2, RoundingMode.HALF_EVEN)); } } return chargingDetails; } @@ -1007,8 +1002,8 @@ 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(); } @@ -1092,6 +1087,7 @@ if(1 == doubleIntegration){ num1 *= 2; } } GetInviteUser query = new GetInviteUser(); @@ -1163,7 +1159,7 @@ 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()); @@ -1216,9 +1212,12 @@ BigDecimal income = new BigDecimal("0"); BigDecimal electronicMoney = new BigDecimal("0"); BigDecimal serviceMoney = new BigDecimal("0"); BigDecimal commissionMoney = new BigDecimal("0"); BigDecimal refundMoney = new BigDecimal("0"); BigDecimal paymentMoney = new BigDecimal("0"); for (ChargingOrderVO chargingOrderVO : list) { chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")).setScale(2,BigDecimal.ROUND_DOWN)); chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount()!=null?chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")):new BigDecimal("0")); chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount()!=null?chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")).setScale(2,BigDecimal.ROUND_DOWN):new BigDecimal("0")); chargingOrderVO.setUid(chargingOrderVO.getId()+""); TChargingGun data3 = chargingGunClient.getChargingGunById(chargingOrderVO.getChargingGunId()).getData(); TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderVO.getChargingPileId()).getData(); @@ -1259,6 +1258,8 @@ } } for (ChargingOrderVO chargingOrderVO : list1) { paymentMoney= paymentMoney.add(chargingOrderVO.getPaymentAmount()!=null?chargingOrderVO.getPaymentAmount():new BigDecimal("0")); commissionMoney = commissionMoney.add(chargingOrderVO.getOrderAmount()!=null?chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")):new BigDecimal("0")); if (chargingOrderVO.getChargingCapacity()!=null){ total = total.add(chargingOrderVO.getElectricity()); } @@ -1271,17 +1272,19 @@ chargingOrderVO.setChargingSecond(l); time+=l; } electronicMoney = electronicMoney.add(chargingOrderVO.getElectrovalence()); serviceMoney = serviceMoney.add(chargingOrderVO.getServiceCharge()); income = income.add(chargingOrderVO.getPaymentAmount()); List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) .eq(TChargingOrderRefund::getChargingOrderId, chargingOrderVO.getId()).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { if (tChargingOrderRefund.getRefundStatus()==2){ refundMoney = refundMoney.add(tChargingOrderRefund.getRefundTotalAmount()); } } electronicMoney = electronicMoney.add(chargingOrderVO.getElectrovalence()!=null?chargingOrderVO.getElectrovalence():new BigDecimal("0")); serviceMoney = serviceMoney.add(chargingOrderVO.getServiceCharge()!=null?chargingOrderVO.getServiceCharge():new BigDecimal("0")); } tCharingOrderVO.setTotal(total); tCharingOrderVO.setTime(time); tCharingOrderVO.setIncome(income); tCharingOrderVO.setIncome(paymentMoney.subtract(commissionMoney)); tCharingOrderVO.setElectronicMoney(electronicMoney); tCharingOrderVO.setServiceMoney(serviceMoney); pageInfo.setRecords(list); @@ -1637,7 +1640,8 @@ chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrder.getOrderAmount()!=null){ chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getOrderAmount().multiply(bigDecimal)); BigDecimal multiply = chargingOrder.getPaymentAmount().multiply(bigDecimal); chargingOrderListInfoVO.setCommissionAmount(multiply.setScale(2, BigDecimal.ROUND_HALF_UP)); } chargingOrderListInfoVO.setElectrovalence(chargingOrder.getElectrovalence()); chargingOrderListInfoVO.setServiceCharge(chargingOrder.getServiceCharge()); @@ -1671,6 +1675,7 @@ } } } chargingOrderListInfoVO.setChargingCapacity(chargingOrder.getChargingCapacity()); chargingOrderListInfoVO.setEndMode(chargingOrder.getEndMode()); @@ -1686,10 +1691,18 @@ } } if (!data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc chargingOrderListInfoVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); chargingOrderListInfoVO.setEndSoc(data6.get(0).getSoc().toString()); chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); int min = 100; int max = 0; for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { if (uploadRealTimeMonitoringData.getSoc()>max){ max = uploadRealTimeMonitoringData.getSoc(); } if (uploadRealTimeMonitoringData.getSoc()!=0 &&uploadRealTimeMonitoringData.getSoc()<min){ min = uploadRealTimeMonitoringData.getSoc(); } } chargingOrderListInfoVO.setEndSoc(max+""); chargingOrderListInfoVO.setStartSoc(min+""); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { @@ -1919,26 +1932,26 @@ } //已充电总度数 BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge); BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge); BigDecimal serviceCharge = originalServicePrice; BigDecimal vipDiscountAmount = BigDecimal.ZERO; //计算优惠金额 if(null != chargingOrder.getVipDiscount()){ vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())).setScale(2, RoundingMode.DOWN); serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()).setScale(2, RoundingMode.DOWN); vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())); serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()); } chargingOrderAccountingStrategy.setChargingCapacity(sharp_peak_charge); chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(2, RoundingMode.DOWN)); chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(2, RoundingMode.DOWN)); chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(2, RoundingMode.DOWN)); chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(2, RoundingMode.DOWN)); chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(4, RoundingMode.HALF_EVEN)); chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(4, RoundingMode.HALF_EVEN)); chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(4, RoundingMode.HALF_EVEN)); chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(4, RoundingMode.HALF_EVEN)); chargingOrderAccountingStrategy.setCreateTime(LocalDateTime.now()); chargingOrderAccountingStrategyService.save(chargingOrderAccountingStrategy); periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc.setScale(2, RoundingMode.DOWN)); periodServicePrice_total = periodServicePrice_total.add(originalServicePrice.setScale(2, RoundingMode.DOWN)); total = total.add(electrovalenc.add(originalServicePrice.setScale(2, RoundingMode.DOWN))); periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc); periodServicePrice_total = periodServicePrice_total.add(originalServicePrice); total = total.add(electrovalenc.add(originalServicePrice)); } @@ -1949,6 +1962,7 @@ //总金额(充值金额+会员折扣金额) BigDecimal decimal = rechargeAmount.add(vipDiscountAmount); //退款金额(已经计算了折扣优惠部分) //如果充电总金额未使用完,则需要退回费用=(原金额/总金额)*(总金额-实际充电金额) BigDecimal refundAmount = rechargeAmount.divide(decimal, new MathContext(4, RoundingMode.HALF_EVEN)).multiply(decimal.subtract(total)); BigDecimal orderAmount = BigDecimal.valueOf(total.doubleValue()); BigDecimal payAmount = BigDecimal.valueOf(total.doubleValue()); @@ -1967,8 +1981,6 @@ //服务费折扣 discountAmount = periodServicePrice_total.multiply((new BigDecimal(1).subtract(chargingOrder.getVipDiscount()))); periodServicePrice_total = periodServicePrice_total.multiply(chargingOrder.getVipDiscount()); TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); BigDecimal maximumDeduction = vip.getMaximumDeduction(); //普通会员有最高优惠限制 @@ -1977,28 +1989,33 @@ } } } //会员折扣金额 discountAmount = discountAmount.setScale(4, RoundingMode.HALF_EVEN); payAmount = payAmount.subtract(discountAmount); periodServicePrice_total = periodServicePrice_total.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.setResidualAmount(rechargeAmount.subtract(total).setScale(2, RoundingMode.HALF_EVEN)); order.setStartTime(LocalDateTime.parse(vo.getStart_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); 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.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.DOWN)); order.setOrderAmount(orderAmount.setScale(2, RoundingMode.HALF_EVEN)); order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.HALF_EVEN)); order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.HALF_EVEN)); 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(); @@ -2011,17 +2028,11 @@ 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); periodServicePrice_total = periodServicePrice_total.subtract(couponDiscountAmount); couponDiscount = couponDiscountAmount; } appCoupon.setStatus(2); appCouponClient.updateAppCoupon(appCoupon); }else{ @@ -2038,15 +2049,10 @@ 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); periodServicePrice_total = periodServicePrice_total.subtract(divide); couponDiscount = divide; } appCoupon.setStatus(2); @@ -2058,10 +2064,17 @@ } } } order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.DOWN)); order.setPaymentAmount(payAmount.setScale(2, RoundingMode.DOWN)); order.setRefundAmount(refundAmount.setScale(2, RoundingMode.DOWN)); //优惠券优惠金额 couponDiscount = couponDiscount.setScale(4, RoundingMode.HALF_EVEN); refundAmount = refundAmount.add(couponDiscount); payAmount = payAmount.subtract(couponDiscount); if(periodServicePrice_total.compareTo(BigDecimal.ZERO) > 0){ periodServicePrice_total = periodServicePrice_total.subtract(couponDiscount); } order.setCouponDiscountAmount(couponDiscount.setScale(2, RoundingMode.HALF_EVEN)); order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.HALF_EVEN)); order.setPaymentAmount(payAmount.setScale(2, RoundingMode.HALF_EVEN)); order.setRefundAmount(refundAmount.setScale(2, RoundingMode.HALF_EVEN)); order.setRefundStatus(1); this.updateById(order); chargingOrder = this.getById(order.getId()); @@ -2075,8 +2088,8 @@ 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); } @@ -2166,8 +2179,7 @@ dto.setRefundReason("充电完成退款"); RefundResp resp = aliPaymentClient.refund(dto).getData(); if(null != resp){ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); if(success.isSuccess()){ chargingOrderRefundService.save(chargingOrderRefund); } @@ -2583,19 +2595,19 @@ } if (tChargingOrder.getPaymentAmount()!=null){ paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); orderCommission = orderCommission.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) .setScale(2,BigDecimal.ROUND_DOWN)); } } // 三方交易手续费 三方收费*0.6% commissionAmount = sharingAmount.multiply(new BigDecimal("0.006")); // 订单手续费 订单支付金额 - 退款金额*0.6% orderCommission = paymentAmount.multiply(new BigDecimal("0.006")); tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setElectrovalence(electrovalence.setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setServiceCharge(serviceCharge.subtract(orderCommission).setScale(2, RoundingMode.HALF_DOWN)); tSettlementConfirm.setOrderCommission(orderCommission.setScale(2,BigDecimal.ROUND_DOWN)); tSettlementConfirm.setOrderCommission(orderCommission); tSettlementConfirm.setVipDiscount(vipDiscount); tSettlementConfirm.setCouponDiscount(couponDiscount); tSettlementConfirm.setSiteId(dto.getSiteId()); @@ -2625,7 +2637,7 @@ BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner()); BigDecimal subtract9 = new BigDecimal("1").subtract(dto.getServicePartner()); // 总电损费用 BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, RoundingMode.HALF_DOWN); BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, BigDecimal.ROUND_DOWN); // 平台承担电损 BigDecimal subtract1 = divide.subtract(tSettlementConfirm.getProportionMoney()); BigDecimal multiply = dto.getServiceMoney().multiply(subtract); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -352,42 +352,22 @@ //检测敏感词 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星好评 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java
@@ -146,7 +146,8 @@ 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(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/RedisLock.java
@@ -41,11 +41,7 @@ } public boolean unlock() { String identifier = redisTemplate.opsForValue().get(lockKey); if (identifier != null && identifier.equals(UUID.randomUUID().toString())) { redisTemplate.delete(lockKey); return true; } return false; redisTemplate.delete(lockKey); return true; } } ruoyi-service/ruoyi-order/src/main/resources/bootstrap.yml
@@ -12,8 +12,8 @@ allow-circular-references: true profiles: # 环境配置 active: dev # active: prod # active: dev active: prod --- spring: config: @@ -56,52 +56,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 @@ -121,7 +121,6 @@ namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a username: nacos password: nacos ip: 192.168.110.111 config: # 配置中心地址 server-addr: 192.168.0.137:8848,192.168.0.123:8848 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -1549,9 +1549,13 @@ 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> ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -30,7 +30,10 @@ 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; @@ -282,9 +285,12 @@ } @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; @@ -361,13 +367,20 @@ 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("购买商品"); req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ data.setOrderId(shopOrder.getId().toString()); return AjaxResult.success(data); } } return AjaxResult.success(); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
@@ -322,7 +322,7 @@ @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 ) { @@ -366,7 +366,7 @@ 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); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TVipService.java
@@ -1,6 +1,7 @@ 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; @@ -19,5 +20,5 @@ 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); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
@@ -124,7 +124,7 @@ 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()); @@ -132,9 +132,9 @@ req.setSubject("充电充值"); req.setBuyerOpenId(user.getAliOpenid()); req.setBody("充电充值"); req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all"); return AjaxResult.success(data); } } ruoyi-service/ruoyi-other/src/main/resources/bootstrap.yml
@@ -12,8 +12,8 @@ allow-circular-references: true profiles: # 环境配置 active: dev # active: prod # active: dev active: prod --- spring: config: @@ -23,7 +23,7 @@ nacos: discovery: # 服务注册地址 server-addr: 192.168.110.169:8848 server-addr: 127.0.0.1:8848 service: ${spring.application.name} group: DEFAULT_GROUP namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb @@ -31,7 +31,7 @@ password: nacos config: # 配置中心地址 server-addr: 192.168.110.169:8848 server-addr: 127.0.0.1:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP name: ${spring.application.name} @@ -56,52 +56,52 @@ type: nacos nacos: # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 127.0.0.1:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos password: nacos registry: type: nacos nacos: application: seata-server # 开发环境 server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb group: DEFAULT_GROUP username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 127.0.0.1:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: # 开发环境 server-addr: 192.168.110.169:8848 # nacos注册中心地址 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos # 生产环境 # server-addr: 192.168.0.137:8848,192.168.0.123:8848 # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a # server-addr: 127.0.0.1:8848 # nacos注册中心地址 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos password: nacos sentinel: transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/config/AliProperties.java
@@ -3,6 +3,7 @@ import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; /** @@ -11,6 +12,7 @@ */ @Data @Component @Configuration @ConfigurationProperties(prefix = "payment.ali") public class AliProperties { /** ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java
@@ -60,10 +60,11 @@ //异步返回参数 model.setPassbackParams(pojo.getPassbackParams()); request.setBizModel(model); request.setNotifyUrl(aliProperties.getNotifyUrl() + pojo.getNotifyUrl()); AlipayTradeCreateResponse response = alipayClient.execute(request); log.info("-----调起支付宝支付-----"); log.info("请求参数:{}", pojo); log.info("请求参数:{}", JSON.toJSONString(request)); log.info("返回结果:{}", response.getBody()); if (response.isSuccess()) { return PaymentResp.build(response.getOutTradeNo(), response.getTradeNo()); ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java
@@ -1,7 +1,11 @@ package com.ruoyi.payment.controller; import com.alipay.api.AlipayApiException; import com.alipay.api.internal.util.AlipaySignature; 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.*; @@ -12,8 +16,12 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * @author zhibing.pu @@ -44,7 +52,6 @@ if(null != payment){ AliPaymentResp aliPaymentResp = new AliPaymentResp(); aliPaymentResp.setTradeNo(payment.getTradeNo()); aliPaymentResp.setNotifyUrl(aliProperties.getNotifyUrl()); return R.ok(aliPaymentResp); } return R.ok(); @@ -88,28 +95,81 @@ } @Resource private OrderClient orderClient; @Resource private ChargingOrderClient chargingOrderClient; @ResponseBody @PostMapping(value = "/allCallBack") public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { @PostMapping(value = "/callBack") public void chargingOrderALICallback(HttpServletRequest request, 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(); // } Map<String, String> callback = alipayCallback(request); if(null != callback){ String out_trade_no = callback.get("out_trade_no"); String attach = callback.get("subject"); String total_amount = callback.get("total_amount"); String transaction_id = callback.get("trade_no"); 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.chargingOrderALICallback(out_trade_no, transaction_id, attach); System.err.println("----充电支付回调"); break; } PrintWriter writer = response.getWriter(); writer.println("success"); writer.flush(); writer.close(); } } catch (Exception e) { e.printStackTrace(); } } public Map<String, String> alipayCallback(HttpServletRequest request){ Map<String,String> params = new HashMap<String,String>(); Map requestParams = request.getParameterMap(); for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); String[] values = (String[]) requestParams.get(name); String valueStr = ""; for (int i = 0; i < values.length; i++) { valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ","; } params.put(name, valueStr); } try { boolean flag = AlipaySignature.rsaCheckV1(params, aliProperties.getAlipayPublicKey(), "UTF-8","RSA2"); if(flag){ Map<String, String> map = new HashMap<>(); String out_trade_no = params.get("out_trade_no"); String subject = params.get("subject"); String total_amount = params.get("total_amount"); String trade_no = params.get("trade_no"); map.put("out_trade_no", out_trade_no);//商家订单号 map.put("subject", subject); map.put("total_amount", total_amount); map.put("trade_no", trade_no);//支付宝交易号 return map; } } catch (AlipayApiException e) { e.printStackTrace(); } return null; } } ruoyi-service/ruoyi-payment/src/main/resources/bootstrap.yml
@@ -8,7 +8,8 @@ allow-circular-references: true profiles: # 环境配置 active: dev # active: dev active: prod --- spring: config: @@ -40,7 +41,6 @@ --- seata: enabled: true application-id: ${spring.application.name} @@ -53,8 +53,16 @@ config: type: nacos nacos: server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 开发环境 # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # data-id: seata-server.properties # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP data-id: seata-server.properties username: nacos @@ -63,16 +71,31 @@ type: nacos nacos: application: seata-server server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 开发环境 # server-addr: 192.168.110.169:8848 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # group: DEFAULT_GROUP # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP username: nacos password: nacos cloud: nacos: discovery: server-addr: 192.168.110.169:8848 namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # 开发环境 # server-addr: 192.168.110.169:8848 # nacos注册中心地址 # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 # group: DEFAULT_GROUP # application: seata-server #Nacos 中 Seata 名称 # username: nacos # password: nacos # 生产环境 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a group: DEFAULT_GROUP application: seata-server #Nacos 中 Seata 名称 username: nacos @@ -81,7 +104,6 @@ transport: dashboard: 127.0.0.1:8080 # Sentinel控制台地址 eager: true --- spring: @@ -92,14 +114,18 @@ nacos: discovery: # 服务注册地址 server-addr: 127.0.0.1:8848 server-addr: 192.168.0.137:8848,192.168.0.123:8848 service: ${spring.application.name} group: DEFAULT_GROUP namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a username: nacos password: nacos config: # 配置中心地址 server-addr: 127.0.0.1:8848 namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 server-addr: 192.168.0.137:8848,192.168.0.123:8848 namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a username: nacos password: nacos group: DEFAULT_GROUP name: ${spring.application.name} # 配置文件格式