Merge remote-tracking branch 'origin/master'
1 文件已重命名
12个文件已修改
2个文件已添加
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "发送短信dto类") |
| | | public class SendMessageDTO implements Serializable { |
| | | |
| | | private String phone; |
| | | private String code; |
| | | private String site; |
| | | private String chargeGun; |
| | | private Integer type;// 1 codeMsg 2 applyCodeMsg 3 faultMsg |
| | | |
| | | } |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | |
| | | public R<String> getWXToken() { |
| | | return R.fail("获取微信token失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> sensitiveWordDetection(String content, String openid) { |
| | | return R.fail("敏感词校验失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> sendMessage(SendMessageDTO sendMessageDTO) { |
| | | return R.fail("短信发送失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | |
| | | */ |
| | | @PostMapping("/wxLogin/getWXToken") |
| | | R<String> getWXToken(); |
| | | |
| | | /** |
| | | * 敏感词检测 |
| | | * @param content |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | @PostMapping("/wxLogin/sensitiveWordDetection") |
| | | R<Boolean> sensitiveWordDetection (@RequestParam("content") String content, @RequestParam("openid") String openid); |
| | | |
| | | /** |
| | | * 短信发送 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-user/sendMessage") |
| | | R<String> sendMessage(@RequestBody SendMessageDTO sendMessageDTO); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * <p>文件上传配置</p> |
| | | * |
| | | * @author mouseyCat |
| | | * @date 2020/10/13 16:10 |
| | | */ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "file.upload") |
| | | public class FileUploadConfig { |
| | | private String accessPath; |
| | | private String allowExt; |
| | | private String location; |
| | | private String qrLocation; |
| | | } |
File was renamed from ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/FileController.java |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.ruoyi.chargingPile.config.FileUploadConfig; |
| | | import com.ruoyi.account.config.FileUploadConfig; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | } |
| | | String TimeDir =new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| | | String realPath = fileUploadConfig.getLocation() + TimeDir; |
| | | // String realPath = "D:\\file\\" + TimeDir; |
| | | File file = new File(realPath); |
| | | // 没有目录就创建 |
| | | if (!file.exists()) { |
| | |
| | | mf.transferTo(targetFile); |
| | | //拼接数据 |
| | | String imgstr = fileUploadConfig.getAccessPath() + TimeDir +"/"+ filename; |
| | | // String imgstr = TimeDir +"/"+ filename; |
| | | return AjaxResult.success(imgstr); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.util.carBrand.CarBrandUtil; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import com.ruoyi.common.core.enums.status.AppUserStatusEnum; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.*; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | |
| | | appUserService.updateById(appUser); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/sendMessage") |
| | | public R<String> sendMessage(@RequestBody SendMessageDTO sendMessageDTO){ |
| | | switch (sendMessageDTO.getType()){ |
| | | case 1: |
| | | String reqStr1 = MsgUtil.codeMsg(sendMessageDTO.getPhone(), sendMessageDTO.getCode()); |
| | | String result1 = HttpUtils.post(MsgConstants.SEND_URL, reqStr1); |
| | | return R.ok(result1); |
| | | case 2: |
| | | String reqStr2 = MsgUtil.applyCodeMsg(sendMessageDTO.getPhone(), sendMessageDTO.getCode()); |
| | | String result2 = HttpUtils.post(MsgConstants.SEND_URL, reqStr2); |
| | | return R.ok(result2); |
| | | default: |
| | | String reqStr3 = MsgUtil.faultMsg(sendMessageDTO.getPhone(), sendMessageDTO.getSite(), sendMessageDTO.getChargeGun()); |
| | | String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); |
| | | return R.ok(result3); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alipay.api.internal.util.codec.Base64; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.FileUploadUtils; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | return R.ok(accessToken); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 敏感词检测 |
| | | * @param content |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | @PostMapping("/sensitiveWordDetection") |
| | | public R<Boolean> sensitiveWordDetection (@RequestParam("content") String content, @RequestParam("openid") String openid){ |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject(); |
| | | jsonObject.put("content", content); |
| | | jsonObject.put("version", 2); |
| | | jsonObject.put("scene", 2); |
| | | jsonObject.put("openid", openid); |
| | | String post = HttpUtils.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + accessToken, jsonObject.toString()); |
| | | com.alibaba.fastjson2.JSONObject object = com.alibaba.fastjson2.JSONObject.parseObject(post); |
| | | Integer errcode = object.getInteger("errcode"); |
| | | if(0 != errcode){ |
| | | throw new RuntimeException(object.getString("errmsg")); |
| | | } |
| | | JSONArray detail = object.getJSONArray("detail"); |
| | | for (int i = 0; i < detail.size(); i++) { |
| | | JSONObject jsonObject1 = detail.getJSONObject(i); |
| | | Integer errcode1 = jsonObject1.getInteger("errcode"); |
| | | if(0 == errcode1){ |
| | | String suggest = jsonObject1.getString("suggest"); |
| | | Integer label = jsonObject1.getInteger("label"); |
| | | String keyword = jsonObject1.getString("keyword"); |
| | | Integer prob = jsonObject1.getInteger("prob"); |
| | | if(("risky".equals(suggest) || "review".equals(suggest)) && 100 != label && StringUtils.isNotEmpty(keyword) && 80 <= prob){ |
| | | return R.ok(true); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(false); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.UPDATE_PHONE,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(phone); |
| | | sendMessageDTO.setCode(code); |
| | | sendMessageDTO.setType(1); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | // String reqStr = MsgUtil.codeMsg(phone, code); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | |
| | | { |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLY_CHARGING,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(phone); |
| | | sendMessageDTO.setCode(code); |
| | | sendMessageDTO.setType(2); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | // String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | | import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO; |
| | |
| | | import com.ruoyi.chargingPile.util.QRCodeUtils; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Override |
| | | public void add(TFaultMessage dto) { |
| | |
| | | Site site = siteService.getById(dto.getSiteId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | String siteName = site.getName(); |
| | | String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setCode(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | log.info("故障短信提醒:{}",result); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | Site site = siteService.getById(dto.getSiteId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | String siteName = site.getName(); |
| | | String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // String reqStr = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setCode(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | log.info("故障短信提醒:{}",result); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/securityDetection") |
| | | public void securityDetection(@RequestBody SecurityDetectionVO securityDetection){ |
| | | log.error("-------------------安全检测数据-------------------:" + securityDetection); |
| | | log.info("-------------------安全检测数据-------------------:" + securityDetection); |
| | | chargingOrderService.securityDetection(securityDetection); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/startChargeSuccessfully") |
| | | public void startChargeSuccessfully(@RequestBody PlatformStartChargingReplyMessageVO message){ |
| | | log.error("-------------------远程启动充电请求应答-------------------:" + message); |
| | | log.info("-------------------远程启动充电请求应答-------------------:" + message); |
| | | chargingOrderService.startChargeSuccessfully(message); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/terminateSuccessfulResponse") |
| | | public void terminateSuccessfulResponse(@RequestBody PlatformStopChargingReplyVO platformStopChargingReply){ |
| | | log.error("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); |
| | | log.info("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); |
| | | chargingOrderService.terminateSuccessfulResponse(platformStopChargingReply); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/endChargeBillingCharge") |
| | | public void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo){ |
| | | log.error("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | log.info("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | chargingOrderService.endChargeBillingCharge(vo); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/endCharge") |
| | | public void endCharge(@RequestParam("code") String code){ |
| | | log.error(code + ":-------------------充电桩自动结束充电-------------------"); |
| | | log.info(code + ":-------------------充电桩自动结束充电-------------------"); |
| | | chargingOrderService.endCharge(code, 2); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/excelEndCharge") |
| | | public void excelEndCharge(@RequestParam("code") String code){ |
| | | log.error(code + ":-------------------充电异常,停止充电-------------------"); |
| | | log.info(code + ":-------------------充电异常,停止充电-------------------"); |
| | | chargingOrderService.excelEndCharge(code); |
| | | } |
| | | |
| | |
| | | platformStartCharging.setCard_number(chargingOrder.getId().toString()); |
| | | platformStartCharging.setAccount_balance(account_balance); |
| | | |
| | | log.error(chargingOrder.getCode() + ":-------------------远程调起开始充电请求-------------------" + platformStartCharging.toString()); |
| | | log.info(chargingOrder.getCode() + ":-------------------远程调起开始充电请求-------------------" + platformStartCharging.toString()); |
| | | sendMessageClient.platformStartCharging(platformStartCharging); |
| | | //异步线程检测远程启动的应答结果。如果失败,则需要全额退款 |
| | | Long id = chargingOrder.getId(); |
| | |
| | | String code = chargingOrder.getCode(); |
| | | String key = "AQJC_" + chargingOrder.getChargingGunId(); |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); |
| | | log.error(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); |
| | | log.info(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); |
| | | if(data.size() != 0){ |
| | | PlatformStartChargingReply platformStartChargingReply = data.get(1); |
| | | Integer startup_result = platformStartChargingReply.getStartup_result(); |
| | |
| | | return true; |
| | | }else{ |
| | | Integer counter = boot_failed_map.get(code); |
| | | log.error(code + ":-------------------未上传开启充电结果-------------------" + counter); |
| | | log.info(code + ":-------------------未上传开启充电结果-------------------" + counter); |
| | | PreChargeCheck preChargeCheck1 = redisService.getCacheObject(key); |
| | | //5分钟内未启动成功,退回金额。 |
| | | if(null == counter || counter < 300){ |
| | |
| | | * @param code |
| | | */ |
| | | public void refund(String code){ |
| | | log.error(code + ":-------------------充电启动失败,执行退款-------------------"); |
| | | log.info(code + ":-------------------充电启动失败,执行退款-------------------"); |
| | | TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, code)); |
| | | if(chargingOrder.getStatus() == 2){ |
| | | Integer rechargePaymentType = chargingOrder.getRechargePaymentType(); |
| | |
| | | platformStopCharging.setCharging_pile_code(chargingPile.getCode()); |
| | | platformStopCharging.setCharging_gun_code(chargingGun.getCode()); |
| | | sendMessageClient.platformStopCharging(platformStopCharging); |
| | | log.error(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.error(platformStopCharging.toString()); |
| | | log.info(code1 + ":-------------------远程停止充电请求-------------------"); |
| | | log.info(platformStopCharging.toString()); |
| | | }); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | failure_cause = "其他"; |
| | | break; |
| | | } |
| | | log.error(code1 + ":停机失败:订单号:{},失败原因:{}", order.getCode(), failure_cause); |
| | | log.info(code1 + ":停机失败:订单号:{},失败原因:{}", order.getCode(), failure_cause); |
| | | }else{ |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | chargingOrder.setId(order.getId()); |
| | |
| | | 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)); |
| | |
| | | //检测敏感词 |
| | | String content = orderEvaluate.getContent(); |
| | | if(StringUtils.isNotEmpty(content)){ |
| | | String token = appUserClient.getWXToken().getData(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("content", content); |
| | | jsonObject.put("version", 2); |
| | | jsonObject.put("scene", 2); |
| | | jsonObject.put("openid", appUser.getWxOpenid()); |
| | | String post = HttpUtils.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + token, jsonObject.toString()); |
| | | JSONObject object = JSONObject.parseObject(post); |
| | | Integer errcode = object.getInteger("errcode"); |
| | | if(0 != errcode){ |
| | | throw new RuntimeException(object.getString("errmsg")); |
| | | } |
| | | JSONArray detail = object.getJSONArray("detail"); |
| | | for (int i = 0; i < detail.size(); i++) { |
| | | JSONObject jsonObject1 = detail.getJSONObject(i); |
| | | Integer errcode1 = jsonObject1.getInteger("errcode"); |
| | | if(0 == errcode1){ |
| | | String suggest = jsonObject1.getString("suggest"); |
| | | Integer label = jsonObject1.getInteger("label"); |
| | | String keyword = jsonObject1.getString("keyword"); |
| | | Integer prob = jsonObject1.getInteger("prob"); |
| | | if(("risky".equals(suggest) || "review".equals(suggest)) && 100 != label && StringUtils.isNotEmpty(keyword) && 80 <= prob){ |
| | | return AjaxResult.error("评价包含违规内容,请重新评价!"); |
| | | } |
| | | } |
| | | Boolean data = appUserClient.sensitiveWordDetection(content, appUser.getWxOpenid()).getData(); |
| | | if(data){ |
| | | return AjaxResult.error("评价包含违规内容,请重新评价!"); |
| | | } |
| | | } |
| | | orderEvaluate.setContent(content); |
| | | this.save(orderEvaluate); |
| | | |
| | | List<Integer> tagIds = query.getTagIds(); |
| | | for (Integer tagId : tagIds) { |
| | | TOrderEvaluateTag orderEvaluateTag = new TOrderEvaluateTag(); |
| | | orderEvaluateTag.setOrderEvaluateId(orderEvaluate.getId()); |
| | | orderEvaluateTag.setEvaluationTagId(tagId); |
| | | orderEvaluateTagMapper.insert(orderEvaluateTag); |
| | | if(null != tagIds){ |
| | | for (Integer tagId : tagIds) { |
| | | TOrderEvaluateTag orderEvaluateTag = new TOrderEvaluateTag(); |
| | | orderEvaluateTag.setOrderEvaluateId(orderEvaluate.getId()); |
| | | orderEvaluateTag.setEvaluationTagId(tagId); |
| | | orderEvaluateTagMapper.insert(orderEvaluateTag); |
| | | } |
| | | } |
| | | |
| | | //判断发放积分 文字+图片+5星好评 |
| | |
| | | orderInvoiceDetail.setAddedServiceTariff(invoiceType.getAddedServiceTariff()); |
| | | orderInvoiceDetail.setElectrovalence(electrovalence); |
| | | orderInvoiceDetail.setServiceCharge(serviceCharge); |
| | | orderInvoiceDetail.setAddedService(serviceCharge.multiply(invoiceType.getAddedServiceTariff().divide(new BigDecimal(100)))); |
| | | orderInvoiceDetail.setAddedService(serviceCharge.multiply(null == invoiceType.getAddedServiceTariff() |
| | | ? new BigDecimal(1) : invoiceType.getAddedServiceTariff().divide(new BigDecimal(100)))); |
| | | orderInvoiceDetailService.save(orderInvoiceDetail); |
| | | } |
| | | return AjaxResult.success(); |