Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
Conflicts:
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "UpdatePhoneDTO对象",description = "更换手机号DTO") |
| | | public class UpdatePhoneDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | @NotBlank(message = "手机号不能为空") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "验证码") |
| | | @NotBlank(message = "验证码不能为空") |
| | | private String code; |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUser> selectByPhone(String phone) { |
| | | return R.fail("通过手机号查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> getUserByIds(List<Long> appUserIds) { |
| | | return R.fail("根据用户id查询用户信息失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | @PostMapping("/t-app-user//user/updateAppUser") |
| | | @PostMapping("/t-app-user/user/updateAppUser") |
| | | R updateAppUser(@RequestBody TAppUser appUser); |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-app-user/user/selectByPhone") |
| | | R<TAppUser> selectByPhone(@RequestParam("phone") String phone); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_charging_pile_notification") |
| | | @ApiModel(value="TChargingPileNotification对象", description="") |
| | | public class TChargingPileNotification implements Serializable { |
| | | public class TChargingPileNotification extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @ApiModelProperty(value = "通知内容") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "发送时间") |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "删除状态(0=否,1=是)") |
| | | @TableField("del_flag") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | |
| | | |
| | | } |
| | |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | | private BigDecimal vipElectrovalence; |
| | | @ApiModelProperty(value = "开通会员预计可省") |
| | | private BigDecimal money; |
| | | @ApiModelProperty(value = "额外赠送优惠券X张") |
| | | private Integer couponCount; |
| | | @ApiModelProperty(value = "超时占位费说明") |
| | | private String spaceChargeExplain; |
| | | |
| | |
| | | @ApiModelProperty(value = "计费策略明细集合") |
| | | private List<TAccountingStrategyDetail> accountingStrategyDetailList; |
| | | |
| | | @ApiModelProperty(value = "一級审核人员") |
| | | private String firstUserName; |
| | | |
| | | @ApiModelProperty(value = "二級审核人员") |
| | | private String twoUserName; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "跳转类型(1=小程序内页面,2=小程序地址,3=网页地址)") |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "显示位置(1=banner广告,2=弹出广告)") |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "使用截止时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "获取后有效天数") |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "月卡折扣开始时间") |
| | | @TableField("monthly_card_discount_start") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime monthlyCardDiscountStart; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣结束时间") |
| | | @TableField("monthly_card_discount_end") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime monthlyCardDiscountEnd; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣显示(0=否,1=是)") |
| | |
| | | |
| | | @ApiModelProperty(value = "季卡折扣开始时间") |
| | | @TableField("season_card_discount_start") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime seasonCardDiscountStart; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣结束时间") |
| | | @TableField("season_card_discount_end") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime seasonCardDiscountEnd; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣显示(0=否,1=是)") |
| | |
| | | |
| | | @ApiModelProperty(value = "年卡折扣开始时间") |
| | | @TableField("annual_card_discount_start") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime annualCardDiscountStart; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣结束时间") |
| | | @TableField("annual_card_discount_end") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime annualCardDiscountEnd; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣显示(0=否,1=是)") |
| | |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | <version>3.6.2</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * token 控制 |
| | |
| | | private SysLoginService sysLoginService; |
| | | @Resource |
| | | private SysUserClient userClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | sysLoginService.register(registerBody.getUsername(), registerBody.getPassword(), request); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public static final String DATE_FORMATTER_TIME = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String DATE_FORMATTER_DATE = "yyyy-MM-dd"; |
| | | |
| | | /** |
| | | * 后缀 |
| | | */ |
| | | public static final String APPLET = "_applet"; |
| | | /** |
| | | * 定时任务违规的字符 |
| | | */ |
New file |
| | |
| | | package com.ruoyi.common.core.constant; |
| | | |
| | | /** |
| | | * 短信常量 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class MsgConstants |
| | | { |
| | | /** 短信发送地址 */ |
| | | public static final String SEND_URL = "http://112.35.1.155:1992/sms/tmpsubmit"; |
| | | /** 更换手机号短信验证码 TEMPLATE_ID */ |
| | | public static final String CODE_TEMPLATE_ID = "5bf3949463e54c03a25c6fce3ad48139"; |
| | | |
| | | /** 停车占位提醒 TEMPLATE_ID */ |
| | | public static final String STOP_TEMPLATE_ID = "4940ce98a3f94f67aa9f5cd2d4e05cbd"; |
| | | |
| | | /** 充电结束 TEMPLATE_ID */ |
| | | public static final String CHARGE_TEMPLATE_ID = "47b2eb376cfa436faae041a6f2f22688"; |
| | | |
| | | /** 桩故障(自动/手动) TEMPLATE_ID */ |
| | | public static final String FAULT_TEMPLATE_ID = "37956469a14a47e484a747a1e7e462de"; |
| | | /** 更换手机号短信验证码 AP_ID */ |
| | | public static final String CODE_AP_ID = "GH123"; |
| | | |
| | | /** 停车占位提醒 AP_ID */ |
| | | public static final String STOP_AP_ID = "TC123"; |
| | | |
| | | /** 充电结束 AP_ID */ |
| | | public static final String CHARGE_AP_ID = "CD123"; |
| | | |
| | | /** 桩故障(自动/手动) AP_ID */ |
| | | public static final String FAULT_AP_ID = "GZ123"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | | import java.net.*; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | /** |
| | | * 通用http发送方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url) |
| | | { |
| | | return sendGet(url, StringUtils.EMPTY); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, String param) |
| | | { |
| | | return sendGet(url, param, Constants.UTF8); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @param contentType 编码类型 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, String param, String contentType) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | BufferedReader in = null; |
| | | try |
| | | { |
| | | String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; |
| | | log.info("sendGet - {}", urlNameString); |
| | | URL realUrl = new URL(urlNameString); |
| | | URLConnection connection = realUrl.openConnection(); |
| | | connection.setRequestProperty("accept", "*/*"); |
| | | connection.setRequestProperty("connection", "Keep-Alive"); |
| | | connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | connection.connect(); |
| | | in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送POST方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendPost(String url, String param) |
| | | { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | StringBuilder result = new StringBuilder(); |
| | | try |
| | | { |
| | | log.info("sendPost - {}", url); |
| | | URL realUrl = new URL(url); |
| | | URLConnection conn = realUrl.openConnection(); |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("contentType", "utf-8"); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | out.print(param); |
| | | out.flush(); |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (out != null) |
| | | { |
| | | out.close(); |
| | | } |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (IOException ex) |
| | | { |
| | | log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static String sendSSLPost(String url, String param) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | String urlNameString = url + "?" + param; |
| | | try |
| | | { |
| | | log.info("sendSSLPost - {}", urlNameString); |
| | | SSLContext sc = SSLContext.getInstance("SSL"); |
| | | sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
| | | URL console = new URL(urlNameString); |
| | | HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("contentType", "utf-8"); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | |
| | | conn.setSSLSocketFactory(sc.getSocketFactory()); |
| | | conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); |
| | | conn.connect(); |
| | | InputStream is = conn.getInputStream(); |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(is)); |
| | | String ret = ""; |
| | | while ((ret = br.readLine()) != null) |
| | | { |
| | | if (ret != null && !"".equals(ret.trim())) |
| | | { |
| | | result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); |
| | | } |
| | | } |
| | | log.info("recv - {}", result); |
| | | conn.disconnect(); |
| | | br.close(); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static String post(String strURL, String params) { |
| | | String result = ""; |
| | | BufferedReader reader = null; |
| | | try { |
| | | URL url = new URL(strURL);// 创建连接 |
| | | HttpURLConnection connection = (HttpURLConnection) url |
| | | .openConnection(); |
| | | connection.setDoOutput(true); |
| | | connection.setDoInput(true); |
| | | connection.setUseCaches(false); |
| | | connection.setInstanceFollowRedirects(true); |
| | | connection.setRequestMethod("POST"); // 设置请求方式 |
| | | connection.setRequestProperty("Accept", "application/json"); // 设置接收数据的格式 |
| | | connection.setRequestProperty("Content-Type", "application/json"); // 设置发送数据的格式 |
| | | connection.connect(); |
| | | if (params != null && !StringUtils.isEmpty(params)) { |
| | | byte[] writebytes = params.getBytes(); |
| | | // 设置文件长度 |
| | | // connection.setRequestProperty("Content-Length", String.valueOf(writebytes.length)); |
| | | OutputStream outwritestream = connection.getOutputStream(); |
| | | outwritestream.write(params.getBytes()); |
| | | outwritestream.flush(); |
| | | outwritestream.close(); |
| | | // Log.d("hlhupload", "doJsonPost: conn"+connection.getResponseCode()); |
| | | } |
| | | if (connection.getResponseCode() == 200) { |
| | | log.info("<<<<<<<<<<<<<请求响应:{}", connection.getResponseMessage()); |
| | | reader = new BufferedReader( |
| | | new InputStreamReader(connection.getInputStream())); |
| | | result = reader.readLine(); |
| | | log.info("<<<<<<<<<<<<<请求响应:{}", result); |
| | | } else { |
| | | throw new ServiceException(connection.getResponseMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new ServiceException("http的post请求异常!" + e.getMessage()); |
| | | } finally { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private static class TrustAnyTrustManager implements X509TrustManager |
| | | { |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[] {}; |
| | | } |
| | | } |
| | | |
| | | private static class TrustAnyHostnameVerifier implements HostnameVerifier |
| | | { |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | public class MD5Util { |
| | | |
| | | /** |
| | | * 给指定字符串按照md5算法去加密 |
| | | * |
| | | * @param psd 需要加密的密码 加盐处理 |
| | | * |
| | | * @return md5后的字符串 |
| | | */ |
| | | public static String encoder(String psd) { |
| | | try { |
| | | //加盐处理 |
| | | psd = psd + "mobilesafe"; |
| | | //1,指定加密算法类型 |
| | | MessageDigest digest = MessageDigest.getInstance("MD5"); |
| | | //2,将需要加密的字符串中转换成byte类型的数组,然后进行随机哈希过程 |
| | | byte[] bs = digest.digest(psd.getBytes()); |
| | | // System.out.println(bs.length); |
| | | //3,循环遍历bs,然后让其生成32位字符串,固定写法 |
| | | //4,拼接字符串过程 |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (byte b : bs) { |
| | | int i = b & 0xff; |
| | | //int类型的i需要转换成16机制字符 |
| | | String hexString = Integer.toHexString(i); |
| | | // System.out.println(hexString); |
| | | if (hexString.length() < 2) { |
| | | hexString = "0" + hexString; |
| | | } |
| | | stringBuffer.append(hexString); |
| | | } |
| | | //5,打印测试 |
| | | System.out.println(stringBuffer.toString()); |
| | | return stringBuffer.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * MD5加密字符串 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5(String str) { |
| | | if (StringUtils.isNotEmpty(str)) { |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | md.update(str.getBytes()); |
| | | byte b[] = md.digest(); |
| | | int i; |
| | | StringBuffer buf = new StringBuffer(""); |
| | | for (int offset = 0; offset < b.length; offset++) { |
| | | i = b[offset]; |
| | | if (i < 0) |
| | | i += 256; |
| | | if (i < 16) |
| | | buf.append("0"); |
| | | buf.append(Integer.toHexString(i)); |
| | | } |
| | | //32位加密(小写) |
| | | return buf.toString(); |
| | | //32位加密(大写) |
| | | //return buf.toString().toUpperCase(); |
| | | // 16位的加密(小写) |
| | | //return buf.toString().substring(8, 24); |
| | | // 16位的加密(大写) |
| | | //return buf.toString().substring(8, 24).toUpperCase(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取32位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_32_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位大写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_upper(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toUpperCase(); |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取16位小写 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String getMD5_16_lower(String str) { |
| | | if (StringUtils.isNotEmpty(str)) |
| | | return getMD5(str).substring(8, 24).toLowerCase(); |
| | | return ""; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.req.SubmitTempletReq; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | |
| | | import java.util.concurrent.ThreadLocalRandom; |
| | | |
| | | public class MsgUtil { |
| | | |
| | | public final static String ecName= "四川明星新能源科技有限公司"; |
| | | public final static String secretKey= "MX_xny2023?9"; |
| | | public final static String sign= "1PUAVuY2b"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 更换手机号:【签名】验证码:XXX,用于更换手机号。请勿转发。 |
| | | * @param phone 手机号 |
| | | * @param code 验证码 |
| | | * @return |
| | | */ |
| | | public static String codeMsg(String phone,String code){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | String[] paramss = {code}; |
| | | submitReq.setApId(MsgConstants.CODE_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | submitReq.setTemplateId(MsgConstants.CODE_TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 停车占位提醒:车辆已在3小时前完成充电,请及时取车,避免长时间占用充电资源。 |
| | | * @param phone 手机号 |
| | | * @return |
| | | */ |
| | | public static String stopMsg(String phone){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | submitReq.setTemplateId(MsgConstants.STOP_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.STOP_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 充电结束:车辆充电结束,请及时取车。 |
| | | * @param phone 手机号 |
| | | * @return |
| | | */ |
| | | public static String chargeStopMsg(String phone){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | submitReq.setTemplateId(MsgConstants.CHARGE_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.CHARGE_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** phone 单词可拼接5000个号码 |
| | | * 桩故障(自动/手动):检测到【电站1】【编号】号桩设备离线,请及时查看处理! |
| | | * @param phone 手机号 |
| | | * @param site 站点名称 |
| | | * @param chargeGun 桩编号 |
| | | * @return |
| | | */ |
| | | public static String faultMsg(String phone,String site,String chargeGun){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | if(site.length()<=10){ |
| | | String[] paramss = {site,chargeGun}; |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | }else{ |
| | | String work1 = site.substring(0,10); |
| | | String[] paramss = {work1,chargeGun}; |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | } |
| | | submitReq.setTemplateId(MsgConstants.FAULT_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.FAULT_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | /** |
| | | * 生成验证码 |
| | | * @return |
| | | */ |
| | | public static String createCode(){ |
| | | return String.valueOf(ThreadLocalRandom.current().nextInt(100000, 999999)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils.req; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class SubmitTempletReq implements Serializable { |
| | | |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String ecName; |
| | | /** |
| | | * 接口账号用户名 |
| | | */ |
| | | private String apId; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String secretKey; |
| | | /** |
| | | * 模板ID。在云MAS平台创建模板,路径:『短信』→『模板短信』→『模板管理』,创建后提交审核,审核通过将获得模板ID。 |
| | | */ |
| | | private String templateId; |
| | | /** |
| | | * 收信手机号码。英文逗号分隔,每批次限5000个号码,例:“13800138000,13800138001,13800138002”。 |
| | | */ |
| | | private String mobiles; |
| | | /** |
| | | * 模板变量。格式:[“param1”,“param2”],无变量模板填[""] |
| | | */ |
| | | private String params; |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | /** |
| | | * 扩展码。依据开户时申请的服务代码匹配类型而定,如为精确匹配,此项填写空字符串("");如为模糊匹配,此项可填写空字符串或自定义的扩展码,注:服务代码加扩展码总长度不能超过20位。 |
| | | */ |
| | | private String addSerial; |
| | | /** |
| | | * 参数校验序列,生成方法:将ecName、apId、secretKey、templateId、mobiles、params、sign、addSerial按序拼接(无间隔符),通过MD5(32位小写)计算出的值。 |
| | | */ |
| | | private String mac; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.web.domain; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class BaseDelete { |
| | | |
| | | @ApiModelProperty(value = "id集合") |
| | | private List<Integer> ids; |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private ChargingOrderClient chargingOrderClient; |
| | | /** |
| | | * 小程序扫一扫 添加车辆 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "添加车辆", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/addCar") |
| | | public AjaxResult addCar(@RequestBody TAppUserCar dto) { |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | appUserCarService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | /** |
| | | * 查询用户可用优惠券数量 |
| | | * @return |
| | | */ |
| | |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.tools.WxAppletTools; |
| | | import com.ruoyi.account.util.GiveVipUtil; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.weaver.loadtime.Aj; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private RedisService redisService; |
| | | @Autowired |
| | | private WeixinProperties wxConfig; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | |
| | | @Resource |
| | | private TAppUserSignService signService; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | | public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.APPLET); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | | if(!code.equals(dto.getCode())){ |
| | | return AjaxResult.error("验证码错误!"); |
| | | } |
| | | // 获取当前用户信息 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserService.getById(userId); |
| | | appUser.setPhone(dto.getPhone()); |
| | | appUserService.updateById(appUser); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id查询用户信息 |
| | | * @param appUserIds 用户id |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @GetMapping("/user/selectByPhone") |
| | | public R<TAppUser> selectByPhone(@RequestParam("phone") String phone){ |
| | | return R.ok(appUserService.getOne(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone,phone) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | |
| | | // @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | // @PostMapping(value = "/user/sign") |
| | |
| | | * @return |
| | | */ |
| | | Map<String, Object> getUserInfo(TAppUser appUser); |
| | | |
| | | /** |
| | | * 账号判断 |
| | | * @param status |
| | | */ |
| | | public void throwInfo(Integer status); |
| | | } |
| | |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | appUser.setPhone(appletUserDecodeData.getPhoneNumber()); |
| | | } |
| | | } |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | throwInfo(appUser.getStatus()); |
| | | } |
| | | appUser.setAvatar(appletUserDecodeData.getAvatarUrl()); |
| | | appUser.setCity(appletUserDecodeData.getCity()); |
| | | appUser.setName(appletUserDecodeData.getNickName()); |
| | |
| | | appUser.setPhone(userInfo.getMobile()); |
| | | } |
| | | } |
| | | if(Objects.nonNull(appUser.getStatus())){ |
| | | throwInfo(appUser.getStatus()); |
| | | } |
| | | appUser.setAvatar(userInfo.getAvatar()); |
| | | appUser.setCity(userInfo.getCity()); |
| | | appUser.setName(userInfo.getNickName()); |
| | |
| | | tokenInfos.put("info",loginUserApplet); |
| | | return tokenInfos; |
| | | } |
| | | |
| | | @Override |
| | | public void throwInfo(Integer status){ |
| | | switch (status){ |
| | | case 2: |
| | | throw new ServiceException("账号被冻结,请联系管理员"); |
| | | case 3: |
| | | throw new ServiceException("账号已注销,请重新注册使用"); |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | public class CodeController { |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"更换手机号获取验证码"}) |
| | | @GetMapping("getCode") |
| | | public AjaxResult getCode(@RequestParam("phone") String phone) |
| | | { |
| | | TAppUser appUser = appUserClient.selectByPhone(phone).getData(); |
| | | if (Objects.nonNull(appUser)){ |
| | | return AjaxResult.error("该手机号已绑定账号"); |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLET,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSiteList") |
| | | @PostMapping("/addSite") |
| | | @ApiOperation(value = "添加站点", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult addSite(@RequestBody Site site){ |
| | | return siteService.addSite(site); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | 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.security.service.TokenService; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | @Autowired |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TAccountingStrategy> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(accountingStrategyService.getById(id)); |
| | | public AjaxResult<TAccountingStrategyVO> getDetailById(@RequestParam("id") Integer id) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); |
| | | TAccountingStrategyVO accountingStrategyVO = new TAccountingStrategyVO(); |
| | | BeanUtils.copyProperties(accountingStrategy,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | String firstUserName = sysUserClient.getSysUser(accountingStrategy.getFirstUserId()).getData().getNickName(); |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | return AjaxResult.ok(accountingStrategyVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "批量删除计费策略") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .in(TAccountingStrategyDetail::getAccountingStrategyId, ids)); |
| | | return AjaxResult.ok(accountingStrategyService.removeByIds(ids)); |
| | | .in(TAccountingStrategyDetail::getAccountingStrategyId, Arrays.asList(split))); |
| | | return AjaxResult.success(accountingStrategyService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "批量删除车库") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 刪除车道信息 |
| | | vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class) |
| | | .in(TVehicleRamp::getCarportId, ids)); |
| | | return AjaxResult.ok(carportService.removeByIds(ids)); |
| | | .in(TVehicleRamp::getCarportId, Arrays.asList(split))); |
| | | return AjaxResult.ok(carportService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | 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 javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "批量删除充电枪") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | return AjaxResult.ok(chargingGunService.removeByIds(ids)); |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | return AjaxResult.ok(chargingGunService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "添加故障报修管理", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-故障报修"},value = "添加故障报修管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TFaultMessage dto) { |
| | | return AjaxResult.ok(faultMessageService.save(dto)); |
| | | public AjaxResult<String> add(@Validated @RequestBody TFaultMessage dto) { |
| | | faultMessageService.add(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO; |
| | | import com.ruoyi.chargingPile.service.TMonitoringEquipmentService; |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除监控", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "批量删除监控") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | return AjaxResult.ok(monitoringEquipmentService.removeByIds(ids)); |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | return AjaxResult.ok(monitoringEquipmentService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "批量删除停车场") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 刪除车道信息 |
| | | vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class) |
| | | .in(TVehicleRamp::getParkingLotId, ids)); |
| | | .in(TVehicleRamp::getParkingLotId, Arrays.asList(split))); |
| | | // 删除车库信息 |
| | | carportService.remove(Wrappers.lambdaQuery(TCarport.class) |
| | | .in(TCarport::getParkingLotId, ids)); |
| | | return AjaxResult.ok(parkingLotService.removeByIds(ids)); |
| | | .in(TCarport::getParkingLotId, Arrays.asList(split))); |
| | | return AjaxResult.ok(parkingLotService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.chargingPile.api.model.TVehicleRamp; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Log(title = "批量删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "批量删除车道") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | | return AjaxResult.ok(vehicleRampService.removeByIds(ids)); |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | return AjaxResult.ok(vehicleRampService.removeByIds(Arrays.asList(split))); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<TChargingPileNotification> chargingPileNotificationPageList(Integer siteId, BasePage basePage); |
| | | |
| | | /** |
| | | * |
| | | * @param type 1=验证码 2=停车占位 3=充电结束 4=桩故障 |
| | | * @param phone 手机号 |
| | | * @param data 内容 |
| | | */ |
| | | void saveData(Integer type,Integer siteId,Integer chargingPileId, String phone, String data); |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface TFaultMessageService extends IService<TFaultMessage> { |
| | | |
| | | /** |
| | | * 添加故障报修管理 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | void add(TFaultMessage dto); |
| | | } |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public void saveData(Integer type,Integer siteId,Integer chargingPileId, String phone, String data) { |
| | | TChargingPileNotification notification = new TChargingPileNotification(); |
| | | switch (type){ |
| | | case 1: |
| | | // 验证码 |
| | | notification.setPhone(phone); |
| | | notification.setContent(data); |
| | | break; |
| | | default: |
| | | // 停车占位 |
| | | notification.setSiteId(siteId); |
| | | notification.setChargingPileId(chargingPileId); |
| | | notification.setPhone(phone); |
| | | notification.setContent(data); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.mapper.TFaultMessageMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | * @author xiaochen |
| | | * @since 2024-08-08 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class TFaultMessageServiceImpl extends ServiceImpl<TFaultMessageMapper, TFaultMessage> implements TFaultMessageService { |
| | | |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | @Override |
| | | public void add(TFaultMessage dto) { |
| | | // 故障短信提醒 |
| | | Site site = siteService.getById(dto.getSiteId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | String siteName = site.getName(); |
| | | String result = MsgUtil.faultMsg(site.getPhone(), site.getName(), chargingPile.getNumber() + ""); |
| | | log.info("故障短信提醒:{}",result); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | | } |
| | | chargingPileNotificationService.saveData(4,dto.getSiteId(),dto.getChargingPileId(),site.getPhone(),"检测到"+siteName+"..."+chargingPile.getNumber()+"号桩设备离线,请及时查看处理!"); |
| | | this.save(dto); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | |
| | | Integer objectId = sysUser.getObjectId(); |
| | | // 查询管理站点下的停车场 |
| | | List<TParkingLotVO> parkingLotVOS = parkingLotService.getList(null); |
| | | if(CollectionUtils.isEmpty(parkingLotVOS)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | List<Integer> parkingLotIds = parkingLotVOS.stream().map(TParkingLotVO::getId).collect(Collectors.toList()); |
| | | |
| | | PageInfo<TMonitoringEquipmentVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TMonitoringEquipmentVO> list = this.baseMapper.pageList(query,pageInfo,parkingLotIds); |
| | | for (TMonitoringEquipmentVO monitoringEquipmentVO : list) { |
| | | TParkingLotVO tParkingLotVO = parkingLotVOS.stream().filter(park -> park.getId().equals(monitoringEquipmentVO.getParkingLotId())).findFirst().get(); |
| | | TParkingLotVO tParkingLotVO = parkingLotVOS.stream().filter(park -> monitoringEquipmentVO.getParkingLotId().equals(park.getId())).findFirst().get(); |
| | | if(null != tParkingLotVO){ |
| | | Integer siteId = tParkingLotVO.getSiteId(); |
| | | monitoringEquipmentVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_MONITOR)); |
| | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.GetNoInvoicedOrder; |
| | | import com.ruoyi.order.dto.MyChargingOrderInfo; |
| | | import com.ruoyi.order.dto.MyChargingOrderList; |
| | | import com.ruoyi.order.dto.OrderEvaluateVo; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.order.service.TOrderEvaluateTagService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | @Autowired |
| | | private TOrderEvaluateTagService orderEvaluateTagService; |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/addEvaluate") |
| | | @ApiOperation(value = "添加评价", tags = {"小程序-扫一扫"}) |
| | | public AjaxResult getMyChargingOrderList(@RequestBody OrderEvaluateVo dto){ |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | orderEvaluateService.addOrderEvaluate(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | /** |
| | | * 查询用户最近一次充电记录使用的车辆 |
| | | * @param |
| | |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-广告管理"},value = "广告列表查询") |
| | | @PostMapping(value = "/list") |
| | | @GetMapping(value = "/list") |
| | | public AjaxResult<List<TAdvertising>> list() { |
| | | return AjaxResult.ok(advertisingService.list(Wrappers.lambdaQuery(TAdvertising.class) |
| | | .eq(TAdvertising::getStatus, AdvertisingStatusEnum.YES.getCode()))); |