Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
1 文件已重命名
50个文件已修改
46个文件已添加
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | |
| | | public class AppUserInfoDto { |
| | | @ApiModelProperty("1是0否") |
| | | private Integer isVip; |
| | | @ApiModelProperty("最低会员价格") |
| | | private BigDecimal minPrice; |
| | | @ApiModelProperty("vip结束时间") |
| | | private LocalDateTime vipExpireTime; |
| | | @ApiModelProperty("当天是否签到") |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @Data |
| | | public class InfoCouponDto { |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @TableField("name") |
| | | private String name; |
| | | private Integer type; |
| | | @ApiModelProperty(value = "优惠方式(1=满减,2=抵扣)") |
| | | @TableField("preferential_mode") |
| | | private Integer preferentialMode; |
| | |
| | | private Long userId; |
| | | @ApiModelProperty("1=正常,2=冻结") |
| | | private Integer status; |
| | | private String remark; |
| | | } |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R change(PointChangeDto points) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUser> selectByPhone(String phone) { |
| | | return R.fail("通过手机号查询用户失败:"+throwable.getMessage()); |
| | | return R.fail("积分变化失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @PostMapping("/t-app-user/user/updateAppUser") |
| | | R updateAppUser(@RequestBody TAppUser appUser); |
| | | |
| | | @PostMapping("/t-app-user/user/points/change") |
| | | R change(@RequestBody PointChangeDto points); |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | | * @param phone |
| | |
| | | @TableField("city_code") |
| | | private String cityCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态(1=正常,2=冻结,3=注销)") |
| | | @TableField("status") |
| | | private Integer status; |
| | |
| | | |
| | | @Data |
| | | public class ApplyChargingQuery extends BasePage { |
| | | String name; |
| | | String landlordPhone; |
| | | } |
| | |
| | | @TableField("landlord_handling") |
| | | private Integer landlordHandling; |
| | | |
| | | |
| | | @ApiModelProperty(value = "户名") |
| | | @TableField("landlord_name") |
| | | private String landlordName; |
| | |
| | | private Integer superCount; |
| | | @ApiModelProperty(value = "慢充数量") |
| | | private Integer slowCount; |
| | | @ApiModelProperty(value = "快充空闲数量") |
| | | private Integer superFreeCount; |
| | | @ApiModelProperty(value = "超充空闲数量") |
| | | private Integer fastFreeCount; |
| | | @ApiModelProperty(value = "慢充空闲数量") |
| | | private Integer slowFreeCount; |
| | | @ApiModelProperty(value = "普通电价") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | |
| | | return R.fail("创建订单" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> shopCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("订单创建" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { |
| | |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-shopping-order/create") |
| | | public R<Long> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | | |
| | | /** |
| | | * 管理后台 活动费用统计 |
New file |
| | |
| | | package com.ruoyi.common.core.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AppGoodQuery extends BasePage { |
| | | @ApiModelProperty("1=购买商品,2=兑换商品") |
| | | private Integer type; |
| | | } |
File was renamed from ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/dto/ExchangeDto.java |
| | |
| | | Integer goodType; |
| | | @ApiModelProperty(hidden = true) |
| | | Integer point; |
| | | @ApiModelProperty("购买数量") |
| | | Integer num; |
| | | @ApiModelProperty("优惠卷id") |
| | | Long couponId; |
| | | |
| | | @ApiModelProperty("1微信2支付宝") |
| | | Integer payMethod; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | @Data |
| | | public class PointChangeDto { |
| | | private Long userId; |
| | | private Integer points; |
| | | private String remark; |
| | | private Integer type; |
| | | } |
| | |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.gateway.filter; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cloud.gateway.filter.GatewayFilterChain; |
| | | import org.springframework.cloud.gateway.filter.GlobalFilter; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.core.Ordered; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.server.reactive.ServerHttpRequest; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.server.ServerWebExchange; |
| | |
| | | import io.jsonwebtoken.Claims; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | return chain.filter(exchange); |
| | | } |
| | | //防抖校验 |
| | | // try { |
| | | // antiShake(request); |
| | | // }catch (Exception e){ |
| | | // log.error("[重复提交]请求路径:{}", exchange.getRequest().getPath()); |
| | | // return ServletUtils.webFluxResponseWriter(exchange.getResponse(), e.getMessage(), HttpStatus.SUCCESS); |
| | | // } |
| | | try { |
| | | antiShake(request); |
| | | }catch (Exception e){ |
| | | log.error("[重复提交]请求路径:{}", exchange.getRequest().getPath()); |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), e.getMessage(), HttpStatus.SUCCESS); |
| | | } |
| | | |
| | | //校验账户是否有效 |
| | | // try { |
| | | // verifyToken(request); |
| | | // verifyAccount(request); |
| | | // }catch (Exception e){ |
| | | // return unauthorizedResponse(exchange, e.getMessage()); |
| | | // } |
| | | try { |
| | | verifyToken(request); |
| | | }catch (Exception e){ |
| | | return unauthorizedResponse(exchange, e.getMessage()); |
| | | } |
| | | String token = getToken(request); |
| | | Claims claims = JwtUtils.parseToken(token); |
| | | String userkey = JwtUtils.getUserKey(claims); |
| | | String userid = JwtUtils.getUserId(claims); |
| | | String username = JwtUtils.getUserName(claims); |
| | | String userType = JwtUtils.getUserType(claims); |
| | | |
| | | // 设置用户信息到请求 |
| | | addHeader(mutate, SecurityConstants.USER_KEY, userkey); |
| | | addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid); |
| | | addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username); |
| | | addHeader(mutate, SecurityConstants.USER_TYPE, userType); |
| | | // 内部请求来源参数清除 |
| | | removeHeader(mutate, SecurityConstants.FROM_SOURCE); |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | |
| | | * 防抖处理 |
| | | */ |
| | | public void antiShake(ServerHttpRequest request) throws Exception{ |
| | | HttpMethod method = request.getMethod(); |
| | | if(HttpMethod.OPTIONS == method){ |
| | | return; |
| | | } |
| | | HttpHeaders headers = request.getHeaders(); |
| | | String client = headers.getFirst("client"); |
| | | String timestamp = headers.getFirst("timestamp"); |
| | | if(StringUtils.isEmpty(client)){ |
| | | throw new RuntimeException("参数异常"); |
| | | } |
| | | if(StringUtils.isEmpty(timestamp)){ |
| | | throw new RuntimeException("参数异常"); |
| | | } |
| | | String url = request.getURI().getPath(); |
| | | Map<String, Object> cacheMap = redisService.getCacheMap(client); |
| | | if(null == cacheMap){ |
| | |
| | | if (claims == null) { |
| | | throw new RuntimeException("令牌已过期或验证不正确!"); |
| | | } |
| | | String userkey = JwtUtils.getUserKey(claims); |
| | | boolean islogin = redisService.hasKey(getTokenKey(userkey)); |
| | | if (!islogin) { |
| | | throw new RuntimeException("登录状态已过期"); |
| | | } |
| | | // String userkey = JwtUtils.getUserKey(claims); |
| | | // boolean islogin = redisService.hasKey(getTokenKey(userkey)); |
| | | // if (!islogin) { |
| | | // throw new RuntimeException("登录状态已过期"); |
| | | // } |
| | | String userid = JwtUtils.getUserId(claims); |
| | | String username = JwtUtils.getUserName(claims); |
| | | if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) { |
| | | throw new RuntimeException("令牌验证失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验账户是否有效 |
| | | * @param request |
| | | * @throws Exception |
| | | */ |
| | | public void verifyAccount(ServerHttpRequest request) throws Exception{ |
| | | String token = getToken(request); |
| | | Claims claims = JwtUtils.parseToken(token); |
| | | String userid = JwtUtils.getUserId(claims); |
| | | String userType = JwtUtils.getUserType(claims); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | throw new RuntimeException("无效的账户"); |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | throw new RuntimeException("账户已被停用,请联系系统管理员!"); |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | TAppUser appUser = appUserClient.getUserById(Long.valueOf(userid)).getData(); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | throw new RuntimeException("无效的账户"); |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | throw new RuntimeException("账户已被冻结,请联系系统管理员!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | userService.resetPwd(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getSysUserById") |
| | | public SysUser getSysUserById(@RequestParam("userId") Long userId){ |
| | | return userService.getById(userId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | TAppUser appUser = appUserClient.getUserById(Long.valueOf(userid)).getData(); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot Actuator --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringCloud Loadbalancer --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-loadbalancer</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Swagger UI --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @ServletComponentScan |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiAccountApplication { |
| | | public static void main(String[] args) { |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | 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.dto.PointChangeDto; |
| | | import com.ruoyi.common.core.enums.status.AppUserStatusEnum; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | import com.ruoyi.order.api.feignClient.ExchangeOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.dto.UnitListQueryDto; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private TAppUserCarService carService; |
| | | @Resource |
| | | private IntegralRuleClient integralRuleClient; |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | |
| | | |
| | |
| | | public R pointsDetail(@RequestBody UserChangeDto userChangeDto) { |
| | | TAppUser appUser = appUserService.getById(userChangeDto.getUserId()); |
| | | appUser.setStatus(userChangeDto.getStatus()); |
| | | appUser.setRemark(userChangeDto.getRemark()); |
| | | appUserService.updateById(appUser); |
| | | return R.ok(); |
| | | } |
| | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser byId = appUserService.getById(userId); |
| | | AppUserInfoDto appUserInfoDto = new AppUserInfoDto(); |
| | | TVip data = vipClient.getVipInfoByType(2).getData(); |
| | | appUserInfoDto.setMinPrice(data.getMonthlyCard()); |
| | | |
| | | //判断会员 |
| | | if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){ |
| | |
| | | TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon,infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | couponDtos.add(infoCouponDto); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | @PostMapping(value = "/user/sign") |
| | | @GetMapping(value = "/user/sign") |
| | | public R sign() { |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | Long userId = loginUserApplet.getUserId(); |
| | |
| | | //签到加积分记录 |
| | | R<TIntegralRule> set = integralRuleClient.getSet(); |
| | | TIntegralRule data = set.getData(); |
| | | JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints()); |
| | | JSONObject jsonObject = JSON.parseObject(data.getSignInForPoints()); |
| | | //增加每日积分 |
| | | Integer points = 0; |
| | | Integer point = jsonObject.getInteger("num1"); |
| | |
| | | signService.updateById(appUserSign); |
| | | } |
| | | } |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points,1,userId,"每日签到",""); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points,1,userId,"每日签到","JF"); |
| | | byId.setPoints(byId.getPoints()+points); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | //已签到日期 |
| | | @ApiOperation(value = "本月已签到日期", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/has/sign") |
| | | public R<List<TAppUserSign>> hasSign() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | DateTime startOfMonth = DateUtil.beginOfMonth(new Date()); |
| | | DateTime endOfMonth = DateUtil.endOfMonth(new Date()); |
| | | // 获取用户的所有签到记录 |
| | | List<TAppUserSign> signRecords = signService.lambdaQuery() |
| | | .between(TAppUserSign::getSignDay, startOfMonth, endOfMonth) |
| | | .eq(TAppUserSign::getAppUserId, userId) |
| | | .orderByDesc(TAppUserSign::getSignDay) |
| | | .list(); |
| | | return R.ok(signRecords); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //已连续签到多少天 |
| | | |
| | | @ApiOperation(value = "本月已连续签到天数", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/continue/sign") |
| | | public R continueSign() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | int days = signDayUtil.calculateContinuousSignDays(userId); |
| | | return R.ok(days); |
| | | } |
| | | |
| | | |
| | | |
| | | //积分变化记录用 |
| | | @PostMapping(value = "/user/points/change") |
| | | public R change(@RequestBody PointChangeDto points) { |
| | | TAppUser byId = appUserService.getById(points.getUserId()); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF"); |
| | | byId.setPoints(byId.getPoints()+points.getPoints()); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @PostMapping(value = "/user/car/addOrUpdate") |
New file |
| | |
| | | package com.ruoyi.account.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | TAppUser appUser = appUserService.getById(userid); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public void addDetail(Integer old,Integer now,Integer type,Long userId,String extension,String code){ |
| | | |
| | | TAppUserIntegralChange tAppUserIntegralChange= new TAppUserIntegralChange(); |
| | | tAppUserIntegralChange.setCode(OrderCodeUtil.getOrderCode("DH")); |
| | | tAppUserIntegralChange.setCode(OrderCodeUtil.getOrderCode(code)); |
| | | tAppUserIntegralChange.setAppUserId(userId); |
| | | tAppUserIntegralChange.setChangeType(type); |
| | | tAppUserIntegralChange.setHistoricalIntegral(old); |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringCloud Loadbalancer --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-loadbalancer</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Swagger UI --> |
| | | <dependency> |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @ServletComponentScan |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiChargingPileApplication { |
| | | public static void main(String[] args) { |
| | |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.builder.ExcelWriterBuilder; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingQuery; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingRemarkDto; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Page<TApplyChargingPile>> page(ApplyChargingQuery applyChargingQuery) { |
| | | Page<TApplyChargingPile> page = applyChargingPileService.lambdaQuery() |
| | | .like(applyChargingQuery.getName() != null && !applyChargingQuery.getName().equals(""), TApplyChargingPile::getAgentPhone, applyChargingQuery.getName()) |
| | | .like(applyChargingQuery.getLandlordPhone() != null && !applyChargingQuery.getLandlordPhone().equals(""), TApplyChargingPile::getLandlordPhone, applyChargingQuery.getLandlordPhone()) |
| | | .page(Page.of(applyChargingQuery.getPageCurr(), applyChargingQuery.getPageSize())); |
| | | return AjaxResult.ok(page); |
| | | } |
| | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | public R export(HttpServletResponse response) { |
| | | public R export(String landlordPhone,HttpServletResponse response) { |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | try { |
| | | List<TApplyChargingPile> list = applyChargingPileService.lambdaQuery().last("limit 1").list(); |
| | | List<TApplyChargingPile> list = applyChargingPileService.lambdaQuery().like(landlordPhone != null && !landlordPhone.equals(""), TApplyChargingPile::getLandlordPhone, landlordPhone).list(); |
| | | |
| | | List<TApplyChargingPileExportDto> exportDtos =new ArrayList<>(); |
| | | for (TApplyChargingPile tApplyChargingPile : list) { |
| | | TApplyChargingPileExportDto applyChargingPileExportDto = new TApplyChargingPileExportDto(); |
| | | BeanUtils.copyProperties(tApplyChargingPile,applyChargingPileExportDto); |
| | | applyChargingPileExportDto.setLandlordFrontIdCard(new URL(tApplyChargingPile.getLandlordFrontIdCard())); |
| | | applyChargingPileExportDto.setLandlordBackIdCard(new URL(tApplyChargingPile.getLandlordBackIdCard())); |
| | | applyChargingPileExportDto.setAgentBackIdCard(new URL(tApplyChargingPile.getAgentBackIdCard())); |
| | | applyChargingPileExportDto.setAgentFrontIdCard(new URL(tApplyChargingPile.getAgentFrontIdCard())); |
| | | List<URL> urls = new ArrayList<>(); |
| | | urls.add(new URL("https://img-blog.csdnimg.cn/direct/c11088e1790049a5b84a0fda21a271b1.png")); |
| | | urls.add(new URL("https://img-blog.csdnimg.cn/direct/c11088e1790049a5b84a0fda21a271b1.png")); |
| | | urls.add(new URL("https://img-blog.csdnimg.cn/direct/c11088e1790049a5b84a0fda21a271b1.png")); |
| | | applyChargingPileExportDto.setUrls(urls); |
| | | JSONArray p1 = JSON.parseArray(tApplyChargingPile.getLandlordFrontIdCard()); |
| | | if (!p1.isEmpty()) { |
| | | applyChargingPileExportDto.setLandlordFrontIdCard(new URL((String) p1.get(0))); |
| | | } |
| | | JSONArray p2 = JSON.parseArray(tApplyChargingPile.getLandlordBackIdCard()); |
| | | if (!p2.isEmpty()){ |
| | | applyChargingPileExportDto.setLandlordBackIdCard(new URL((String)p2.get(0)));} |
| | | JSONArray p3 = JSON.parseArray(tApplyChargingPile.getAgentBackIdCard()); |
| | | if (!p3.isEmpty()) |
| | | applyChargingPileExportDto.setAgentBackIdCard(new URL((String)p3.get(0))); |
| | | JSONArray p4 = JSON.parseArray(tApplyChargingPile.getAgentFrontIdCard()); |
| | | if (!p4.isEmpty()) { |
| | | applyChargingPileExportDto.setAgentFrontIdCard(new URL((String)p4.get(0))); |
| | | } |
| | | |
| | | if (tApplyChargingPile.getChargingPileUser()==1){ |
| | | JSONArray pics1 = JSON.parseArray(tApplyChargingPile.getFixedParkingPropertyRights()); |
| | | if (!pics1.isEmpty()) { |
| | | applyChargingPileExportDto.setPics1(new URL((String)pics1.get(0))); |
| | | } |
| | | JSONArray pics2 = JSON.parseArray(tApplyChargingPile.getConstructionCertificate()); |
| | | if (!pics1.isEmpty()) { |
| | | applyChargingPileExportDto.setPics2(new URL((String)pics2.get(0))); |
| | | } |
| | | }else { |
| | | JSONArray pics1 = JSON.parseArray(tApplyChargingPile.getTitleCertificate()); |
| | | if (!pics1.isEmpty()) { |
| | | applyChargingPileExportDto.setPics1(new URL((String)pics1.get(0))); |
| | | } |
| | | JSONArray pics2 = JSON.parseArray(tApplyChargingPile.getBusinessLicense()); |
| | | if (!pics1.isEmpty()) { |
| | | applyChargingPileExportDto.setPics2(new URL((String)pics2.get(0))); |
| | | } |
| | | } |
| | | |
| | | JSONArray objects1 = JSON.parseArray(tApplyChargingPile.getFurtherInformation()); |
| | | for (int i = 0; i < objects1.size(); i++) { |
| | | JSONObject jsonObject = JSON.parseObject(objects1.get(i).toString()); |
| | | System.err.println("==================="+jsonObject.get("url")); |
| | | |
| | | boolean isImage = isImageUrl(jsonObject); |
| | | if (!isImage){ |
| | | continue; |
| | | } |
| | | System.err.println("Is image: " + isImage); |
| | | if (i==0){ |
| | | applyChargingPileExportDto.setUrl1(new URL((String)jsonObject.get("url"))); |
| | | }else if (i==1){ |
| | | applyChargingPileExportDto.setUrl2(new URL((String)jsonObject.get("url"))); |
| | | }else if (i==2){ |
| | | applyChargingPileExportDto.setUrl3(new URL((String)jsonObject.get("url"))); |
| | | }else if (i==3){ |
| | | applyChargingPileExportDto.setUrl4(new URL((String)jsonObject.get("url"))); |
| | | }else if (i==4){ |
| | | applyChargingPileExportDto.setUrl5(new URL((String)jsonObject.get("url"))); |
| | | }else if (i==5){ |
| | | applyChargingPileExportDto.setUrl6(new URL((String)jsonObject.get("url"))); |
| | | } |
| | | } |
| | | |
| | | if (tApplyChargingPile.getLandlordHandling()==1){ |
| | | applyChargingPileExportDto.setIs1("是"); |
| | | }else { |
| | | applyChargingPileExportDto.setIs1("否"); |
| | | } |
| | | if (tApplyChargingPile.getChargingPileUser()==1){ |
| | | applyChargingPileExportDto.setIs2("是"); |
| | | }else { |
| | | applyChargingPileExportDto.setIs2("否"); |
| | | } |
| | | if (tApplyChargingPile.getChargingPile()==1){ |
| | | applyChargingPileExportDto.setIs3("是"); |
| | | }else { |
| | | applyChargingPileExportDto.setIs3("否"); |
| | | } |
| | | exportDtos.add(applyChargingPileExportDto); |
| | | |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static boolean isImageUrl(JSONObject jsonObject) { |
| | | String url = jsonObject.getString("url"); |
| | | Pattern pattern = Pattern.compile( |
| | | "^.*\\.(?i)(jpg|jpeg|png|gif|bmp|webp)$" |
| | | ); |
| | | return pattern.matcher(url).matches(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "详情") |
| | | @PostMapping(value = "/detail/{id}") |
| | | public AjaxResult<TApplyChargingPile> detail(@PathVariable Integer id) { |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | @TableField("remark") |
| | | private String remark; |
| | | private List<URL> urls; |
| | | private URL pics1; |
| | | private URL pics2; |
| | | private URL url1; |
| | | private URL url2; |
| | | private URL url3; |
| | | private URL url4; |
| | | private URL url5; |
| | | private URL url6; |
| | | private String is1; |
| | | private String is2; |
| | | private String is3; |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | TAppUser appUser = appUserClient.getUserById(Long.valueOf(userid)).getData(); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<SiteVO> getMapSiteList(SiteQuery query) { |
| | | |
| | | if(StringUtils.isEmpty(query.getLon()) || StringUtils.isEmpty(query.getLat())){ |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | |
| | | ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status, ts.construction_site, ts.img_url, |
| | | ts.lon, ts.lat, ts.address, ts.country_code, ts.phone,ts.guide, ts.service_description, ts.vehicle_description, |
| | | ts.parking_space, ts.rate_description, ts.space_charge_explain, ts.accounting_strategy_id,ts.del_flag,tcg.fastCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence,tcg.superFreeCount,tcg.fastFreeCount,tcg.slowFreeCount, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | |
| | | select site_id, |
| | | SUM(CASE WHEN charge_mode = 1 THEN 1 ELSE 0 END) AS superCount, |
| | | SUM(CASE WHEN charge_mode = 2 THEN 1 ELSE 0 END) AS fastCount, |
| | | SUM(CASE WHEN charge_mode = 3 THEN 1 ELSE 0 END) AS slowCount |
| | | SUM(CASE WHEN charge_mode = 3 THEN 1 ELSE 0 END) AS slowCount, |
| | | SUM(CASE WHEN charge_mode = 1 and `status` = 2 THEN 1 ELSE 0 END) AS superFreeCount, |
| | | SUM(CASE WHEN charge_mode = 2 and `status` = 2 THEN 1 ELSE 0 END) AS fastFreeCount, |
| | | SUM(CASE WHEN charge_mode = 3 and `status` = 2 THEN 1 ELSE 0 END) AS slowFreeCount |
| | | from |
| | | t_charging_gun |
| | | where |
| | |
| | | <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot Actuator --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringCloud Loadbalancer --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-loadbalancer</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Swagger UI --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | |
| | | package com.ruoyi.integration.iotda.constant; |
| | | |
| | | public class IotConstant { |
| | | public static final int SUCCESS = 1; |
| | | public static final int FAIL = 0; |
| | | /** |
| | | * 华为云iot token |
| | | */ |
| | |
| | | * 登录认证应答 |
| | | */ |
| | | public static final String ONLINE_REPLY = "online_reply"; |
| | | /** |
| | | * 登录认证应答 |
| | | */ |
| | | public static final String PONG = "pong"; |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | */ |
| | | public static final String BILLING_MODE_VERIFY_REPLY = "billing_mode_verify_reply"; |
| | | /** |
| | | * 计费模型请求应答 |
| | | */ |
| | | public static final String ACQUISITION_BILLING_MODE_REPLY = "acquisition_billing_mode_reply"; |
| | | /** |
| | | * 读取实时监测数据 |
| | | */ |
| | | public static final String READ_REAL_TIME_MONITORING_DATA = "read_real_time_monitoring_data"; |
| | | /** |
| | | * 充电结束 |
| | | */ |
| | | public static final String END_CHARGE = "end_charge"; |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | */ |
| | | public static final String PLATFORM_CONFIRMATION_CHARGING = "platform_confirmation_charging"; |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | */ |
| | | public static final String PLATFORM_START_CHARGING = "platform_start_charging"; |
| | | /** |
| | | * 运营平台远程停机 |
| | | */ |
| | | public static final String PLATFORM_STOP_CHARGING = "platform_stop_charging"; |
| | | /** |
| | | * 交易记录确认 |
| | | */ |
| | | public static final String CONFIRM_TRANSACTION_RECORD = "confirm_transaction_record"; |
| | | /** |
| | | * 远程账户余额更新 |
| | | */ |
| | | public static final String UPDATE_BALANCE = "update_balance"; |
| | | /** |
| | | * 离线卡数据同步 |
| | | */ |
| | | public static final String SYNCHRONIZE_OFFLINE_CARD = "synchronize_offline_card"; |
| | | /** |
| | | * 离线卡数据清除 |
| | | */ |
| | | public static final String CLEAR_OFFLINE_CARD = "clear_offline_card"; |
| | | /** |
| | | * 离线卡数据查询 |
| | | */ |
| | | public static final String QUERY_OFFLINE_CARD = "query_offline_card"; |
| | | /** |
| | | * 充电桩工作参数设置 |
| | | */ |
| | | public static final String WORKING_PARAMETER_SETTING = "working_parameter_setting"; |
| | | /** |
| | | * 对时设置 |
| | | */ |
| | | public static final String TIMING_SETTING = "timing_setting"; |
| | | /** |
| | | * 计费模型设置 |
| | | */ |
| | | public static final String SETUP_BILLING_MODEL = "setup_billing_model"; |
| | | /** |
| | | * 遥控地锁升锁与降锁命令 (下行) |
| | | */ |
| | | public static final String OPEN_OR_CLOSE_GROUND_LOCK = "open_or_close_ground_lock"; |
| | | /** |
| | | * 远程重启 |
| | | */ |
| | | public static final String PLATFORM_RESTART = "platform_restart"; |
| | | /** |
| | | * 远程更新 |
| | | */ |
| | | public static final String PLATFORM_REMOTE_UPDATE = "platform_remote_update"; |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.integration.iotda.constant.ServiceIdConstant; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import com.ruoyi.integration.mongodb.model.*; |
| | | import com.ruoyi.integration.mongodb.service.*; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | public class MessageUtil { |
| | | |
| | | @Autowired |
| | | private OnlineReplyService onlineReplyService; |
| | | @Autowired |
| | | private PongService pongService; |
| | | @Autowired |
| | | private BillingModeVerifyReplyService billingModeVerifyReplyService; |
| | | @Autowired |
| | | private AcquisitionBillingModeReplyService acquisitionBillingModeReplyService; |
| | | @Autowired |
| | | private ReadRealTimeMonitoringDataService readRealTimeMonitoringDataService; |
| | | @Autowired |
| | | private EndChargeService endChargeService; |
| | | @Autowired |
| | | private PlatformConfirmationChargingService platformConfirmationChargingService; |
| | | @Autowired |
| | | private PlatformStartChargingService platformStartChargingService; |
| | | @Autowired |
| | | private PlatformStopChargingService platformStopChargingService; |
| | | @Autowired |
| | | private ConfirmTransactionRecordService confirmTransactionRecordService; |
| | | @Autowired |
| | | private UpdateBalanceService updateBalanceService; |
| | | @Autowired |
| | | private SynchronizeOfflineCardService synchronizeOfflineCardService; |
| | | @Autowired |
| | | private ClearOfflineCardService clearOfflineCardService; |
| | | @Autowired |
| | | private QueryOfflineCardService queryOfflineCardService; |
| | | @Autowired |
| | | private WorkingParameterSettingService workingParameterSettingService; |
| | | @Autowired |
| | | private TimingSettingService timingSettingService; |
| | | @Autowired |
| | | private SetupBillingModelService setupBillingModelService; |
| | | @Autowired |
| | | private OpenOrCloseGroundLockService openOrCloseGroundLockService; |
| | | @Autowired |
| | | private PlatformRestartService platformRestartService; |
| | | @Autowired |
| | | private PlatformRemoteUpdateService platformRemoteUpdateService; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | | * @param charging_pile_code 桩编码 |
| | | * @param online_result 登录结果(0:成功,1:失败) |
| | | * @param onlineReply 实体对象 |
| | | * @return |
| | | */ |
| | | public static String onlineReply(String charging_pile_code,Integer online_result){ |
| | | Map<String,Object> map = new HashMap<>(3); |
| | | map.put("service_id", ServiceIdConstant.ONLINE_REPLY); |
| | | map.put("charging_pile_code",charging_pile_code); |
| | | map.put("online_result",online_result); |
| | | return JSONObject.toJSONString(map); |
| | | public String onlineReply(OnlineReply onlineReply){ |
| | | onlineReplyService.create(onlineReply); |
| | | return getMessageJsonString(onlineReply, ServiceIdConstant.ONLINE_REPLY); |
| | | } |
| | | |
| | | /** |
| | | * 心跳包应答 |
| | | * @param charging_pile_code 桩编码 |
| | | * @param charging_gun_code 枪号 |
| | | * @param charging_gun_status 心跳应答(0) |
| | | * @param pong 实体对象 |
| | | * @return |
| | | */ |
| | | public static String pong(String charging_pile_code,String charging_gun_code,Integer charging_gun_status){ |
| | | Map<String,Object> map = new HashMap<>(3); |
| | | map.put("service_id", ServiceIdConstant.ONLINE_REPLY); |
| | | map.put("charging_pile_code",charging_pile_code); |
| | | map.put("charging_gun_code",charging_gun_code); |
| | | map.put("charging_gun_status",charging_gun_status); |
| | | return JSONObject.toJSONString(map); |
| | | public String pong(Pong pong){ |
| | | pongService.create(pong); |
| | | return getMessageJsonString(pong, ServiceIdConstant.PONG); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | * @param billingModeVerifyReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdConstant.BILLING_MODE_VERIFY_REPLY); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | * @param acquisitionBillingModeReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ |
| | | acquisitionBillingModeReplyService.create(acquisitionBillingModeReply); |
| | | return getMessageJsonString(acquisitionBillingModeReply, ServiceIdConstant.ACQUISITION_BILLING_MODE_REPLY); |
| | | } |
| | | |
| | | /** |
| | | * 读取实时监测数据 |
| | | * @param readRealTimeMonitoringData 实体对象 |
| | | * @return |
| | | */ |
| | | public String readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ |
| | | readRealTimeMonitoringDataService.create(readRealTimeMonitoringData); |
| | | return getMessageJsonString(readRealTimeMonitoringData, ServiceIdConstant.READ_REAL_TIME_MONITORING_DATA); |
| | | } |
| | | |
| | | /** |
| | | * 充电结束 |
| | | * @param endCharge 实体对象 |
| | | * @return |
| | | */ |
| | | public String endCharge(EndCharge endCharge){ |
| | | endChargeService.create(endCharge); |
| | | return getMessageJsonString(endCharge, ServiceIdConstant.END_CHARGE); |
| | | } |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | * @param platformConfirmationCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){ |
| | | platformConfirmationChargingService.create(platformConfirmationCharging); |
| | | return getMessageJsonString(platformConfirmationCharging, ServiceIdConstant.PLATFORM_CONFIRMATION_CHARGING); |
| | | } |
| | | |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | * @param platformStartCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformConfirmationCharging(PlatformStartCharging platformStartCharging){ |
| | | platformStartChargingService.create(platformStartCharging); |
| | | return getMessageJsonString(platformStartCharging, ServiceIdConstant.PLATFORM_START_CHARGING); |
| | | } |
| | | |
| | | /** |
| | | * 运营平台远程停机 |
| | | * @param platformStopCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformStopCharging(PlatformStopCharging platformStopCharging){ |
| | | platformStopChargingService.create(platformStopCharging); |
| | | return getMessageJsonString(platformStopCharging, ServiceIdConstant.PLATFORM_STOP_CHARGING); |
| | | } |
| | | |
| | | /** |
| | | * 交易记录确认 |
| | | * @param confirmTransactionRecord 实体对象 |
| | | * @return |
| | | */ |
| | | public String confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord){ |
| | | confirmTransactionRecordService.create(confirmTransactionRecord); |
| | | return getMessageJsonString(confirmTransactionRecord, ServiceIdConstant.CONFIRM_TRANSACTION_RECORD); |
| | | } |
| | | |
| | | /** |
| | | * 远程账户余额更新 |
| | | * @param updateBalance 实体对象 |
| | | * @return |
| | | */ |
| | | public String updateBalance(UpdateBalance updateBalance){ |
| | | updateBalanceService.create(updateBalance); |
| | | return getMessageJsonString(updateBalance, ServiceIdConstant.UPDATE_BALANCE); |
| | | } |
| | | |
| | | /** |
| | | * 离线卡数据同步 |
| | | * @param synchronizeOfflineCard 实体对象 |
| | | * @return |
| | | */ |
| | | public String synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard){ |
| | | synchronizeOfflineCardService.create(synchronizeOfflineCard); |
| | | return getMessageJsonString(synchronizeOfflineCard, ServiceIdConstant.SYNCHRONIZE_OFFLINE_CARD); |
| | | } |
| | | |
| | | /** |
| | | * 离线卡数据清除 |
| | | * @param clearOfflineCard 实体对象 |
| | | * @return |
| | | */ |
| | | public String clearOfflineCard(ClearOfflineCard clearOfflineCard){ |
| | | clearOfflineCardService.create(clearOfflineCard); |
| | | return getMessageJsonString(clearOfflineCard, ServiceIdConstant.CLEAR_OFFLINE_CARD); |
| | | } |
| | | |
| | | /** |
| | | * 离线卡数据查询 |
| | | * @param queryOfflineCard 实体对象 |
| | | * @return |
| | | */ |
| | | public String queryOfflineCard(QueryOfflineCard queryOfflineCard){ |
| | | queryOfflineCardService.create(queryOfflineCard); |
| | | return getMessageJsonString(queryOfflineCard, ServiceIdConstant.QUERY_OFFLINE_CARD); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩工作参数设置 |
| | | * @param workingParameterSetting 实体对象 |
| | | * @return |
| | | */ |
| | | public String workingParameterSetting(WorkingParameterSetting workingParameterSetting){ |
| | | workingParameterSettingService.create(workingParameterSetting); |
| | | return getMessageJsonString(workingParameterSetting, ServiceIdConstant.WORKING_PARAMETER_SETTING); |
| | | } |
| | | |
| | | /** |
| | | * 对时设置 |
| | | * @param timingSetting 实体对象 |
| | | * @return |
| | | */ |
| | | public String timingSetting(TimingSetting timingSetting){ |
| | | timingSettingService.create(timingSetting); |
| | | return getMessageJsonString(timingSetting, ServiceIdConstant.TIMING_SETTING); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型设置 |
| | | * @param setupBillingModel 实体对象 |
| | | * @return |
| | | */ |
| | | public String setupBillingModel(SetupBillingModel setupBillingModel){ |
| | | setupBillingModelService.create(setupBillingModel); |
| | | return getMessageJsonString(setupBillingModel, ServiceIdConstant.SETUP_BILLING_MODEL); |
| | | } |
| | | |
| | | /** |
| | | * 遥控地锁升锁与降锁命令 (下行) |
| | | * @param openOrCloseGroundLock 实体对象 |
| | | * @return |
| | | */ |
| | | public String openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock){ |
| | | openOrCloseGroundLockService.create(openOrCloseGroundLock); |
| | | return getMessageJsonString(openOrCloseGroundLock, ServiceIdConstant.OPEN_OR_CLOSE_GROUND_LOCK); |
| | | } |
| | | /** |
| | | * 远程重启 |
| | | * @param platformRestart 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformRestart(PlatformRestart platformRestart){ |
| | | platformRestartService.create(platformRestart); |
| | | return getMessageJsonString(platformRestart, ServiceIdConstant.PLATFORM_RESTART); |
| | | } |
| | | /** |
| | | * 远程更新 |
| | | * @param platformRemoteUpdate 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate){ |
| | | platformRemoteUpdateService.create(platformRemoteUpdate); |
| | | return getMessageJsonString(platformRemoteUpdate, ServiceIdConstant.PLATFORM_REMOTE_UPDATE); |
| | | } |
| | | |
| | | /** |
| | | * 统一封装消息 |
| | | * @param object 实体对象 |
| | | * @param serviceId 服务ID |
| | | * @return |
| | | */ |
| | | private String getMessageJsonString(Object object, String serviceId){ |
| | | JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
| | | jsonObject.put("service_id", serviceId); |
| | | return jsonObject.toJSONString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.base; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BaseService<T> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param t 实体类 |
| | | * @return 添加结果 1=成功 0=失败 |
| | | */ |
| | | int create(T t); |
| | | |
| | | /** |
| | | * 根据id查询 |
| | | * @param id 实体id |
| | | * @return 实体对象 |
| | | */ |
| | | T findById(String id); |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * @return 实体列表 |
| | | */ |
| | | List<T> findAll(); |
| | | |
| | | } |
| | |
| | | public class UpdateBalance { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | private BigDecimal account_balance;// 修改后账户金额 |
| | | |
| | | } |
| | | |
| | |
| | | public class UpdateBalanceReply { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number;// 物理卡号 |
| | | private BigDecimal account_balance;// 修改后账户金额 |
| | | |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; |
| | | |
| | | public interface AcquisitionBillingModeReplyService extends BaseService<AcquisitionBillingModeReply> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | public interface BillingModeVerifyReplyService extends BaseService<BillingModeVerifyReply> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ClearOfflineCard; |
| | | |
| | | public interface ClearOfflineCardService extends BaseService<ClearOfflineCard> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ConfirmTransactionRecord; |
| | | |
| | | public interface ConfirmTransactionRecordService extends BaseService<ConfirmTransactionRecord> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.EndCharge; |
| | | |
| | | public interface EndChargeService extends BaseService<EndCharge> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.OnlineReply; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 登录认证应答接口 |
| | | */ |
| | | public interface OnlineReplyService { |
| | | public interface OnlineReplyService extends BaseService<OnlineReply> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 充电桩登录认证接口 |
| | | */ |
| | | public interface OnlineService { |
| | | public interface OnlineService extends BaseService<Online> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.OpenOrCloseGroundLock; |
| | | |
| | | public interface OpenOrCloseGroundLockService extends BaseService<OpenOrCloseGroundLock> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; |
| | | |
| | | public interface PlatformConfirmationChargingService extends BaseService<PlatformConfirmationCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRemoteUpdate; |
| | | |
| | | public interface PlatformRemoteUpdateService extends BaseService<PlatformRemoteUpdate> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRestart; |
| | | |
| | | public interface PlatformRestartService extends BaseService<PlatformRestart> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStartCharging; |
| | | |
| | | public interface PlatformStartChargingService extends BaseService<PlatformStartCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStopCharging; |
| | | |
| | | public interface PlatformStopChargingService extends BaseService<PlatformStopCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 心跳包应答接口 |
| | | */ |
| | | public interface PongService extends BaseService<Pong> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.QueryOfflineCard; |
| | | |
| | | public interface QueryOfflineCardService extends BaseService<QueryOfflineCard> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; |
| | | |
| | | public interface ReadRealTimeMonitoringDataService extends BaseService<ReadRealTimeMonitoringData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.SetupBillingModel; |
| | | |
| | | public interface SetupBillingModelService extends BaseService<SetupBillingModel> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.SynchronizeOfflineCard; |
| | | |
| | | public interface SynchronizeOfflineCardService extends BaseService<SynchronizeOfflineCard> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.TimingSetting; |
| | | |
| | | public interface TimingSettingService extends BaseService<TimingSetting> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.UpdateBalance; |
| | | |
| | | public interface UpdateBalanceService extends BaseService<UpdateBalance> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.WorkingParameterSetting; |
| | | |
| | | public interface WorkingParameterSettingService extends BaseService<WorkingParameterSetting> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | @Service |
| | | public class AcquisitionBillingModeReplyServiceImpl implements AcquisitionBillingModeReplyService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(AcquisitionBillingModeReply acquisitionBillingModeReply) { |
| | | mongoTemplate.save(acquisitionBillingModeReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public AcquisitionBillingModeReply findById(String id) { |
| | | return mongoTemplate.findById(id, AcquisitionBillingModeReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<AcquisitionBillingModeReply> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingModeReply.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | @Service |
| | | public class BillingModeVerifyReplyServiceImpl implements BillingModeVerifyReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(BillingModeVerifyReply billingModeVerifyReply) { |
| | | mongoTemplate.save(billingModeVerifyReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BillingModeVerifyReply findById(String id) { |
| | | return mongoTemplate.findById(id, BillingModeVerifyReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerifyReply> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerifyReply.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ClearOfflineCard; |
| | | import com.ruoyi.integration.mongodb.service.ClearOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ClearOfflineCardServiceImpl implements ClearOfflineCardService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ClearOfflineCard clearOfflineCard) { |
| | | mongoTemplate.save(clearOfflineCard); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ClearOfflineCard findById(String id) { |
| | | return mongoTemplate.findById(id, ClearOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClearOfflineCard> findAll() { |
| | | return mongoTemplate.findAll(ClearOfflineCard.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ConfirmTransactionRecord; |
| | | import com.ruoyi.integration.mongodb.service.ConfirmTransactionRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ConfirmTransactionRecordServiceImpl implements ConfirmTransactionRecordService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(ConfirmTransactionRecord confirmTransactionRecord) { |
| | | mongoTemplate.save(confirmTransactionRecord); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ConfirmTransactionRecord findById(String id) { |
| | | return mongoTemplate.findById(id, ConfirmTransactionRecord.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ConfirmTransactionRecord> findAll() { |
| | | return mongoTemplate.findAll(ConfirmTransactionRecord.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.EndCharge; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import com.ruoyi.integration.mongodb.service.EndChargeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class EndChargeServiceImpl implements EndChargeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(EndCharge endCharge) { |
| | | mongoTemplate.save(endCharge); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public EndCharge findById(String id) { |
| | | return mongoTemplate.findById(id, EndCharge.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<EndCharge> findAll() { |
| | | return mongoTemplate.findAll(EndCharge.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.OnlineReply; |
| | | import com.ruoyi.integration.mongodb.service.OnlineReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class OnlineReplyServiceImpl implements OnlineReplyService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(OnlineReply onlineReply) { |
| | | mongoTemplate.save(onlineReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public OnlineReply findById(String id) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<OnlineReply> findAll() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @Service |
| | | public class OnlineServiceImpl implements OnlineService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Online online) { |
| | | mongoTemplate.save(online); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Online findById(String id) { |
| | | return mongoTemplate.findById(id, Online.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Online> findAll() { |
| | | return mongoTemplate.findAll(Online.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.OpenOrCloseGroundLock; |
| | | import com.ruoyi.integration.mongodb.service.OpenOrCloseGroundLockService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class OpenOrCloseGroundLockServiceImpl implements OpenOrCloseGroundLockService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(OpenOrCloseGroundLock openOrCloseGroundLock) { |
| | | mongoTemplate.save(openOrCloseGroundLock); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public OpenOrCloseGroundLock findById(String id) { |
| | | return mongoTemplate.findById(id, OpenOrCloseGroundLock.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<OpenOrCloseGroundLock> findAll() { |
| | | return mongoTemplate.findAll(OpenOrCloseGroundLock.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformConfirmationChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformConfirmationChargingServiceImpl implements PlatformConfirmationChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformConfirmationCharging platformConfirmationCharging) { |
| | | mongoTemplate.save(platformConfirmationCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformConfirmationCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformConfirmationCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformConfirmationCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformConfirmationCharging.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRemoteUpdate; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRemoteUpdateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformRemoteUpdateServiceImpl implements PlatformRemoteUpdateService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformRemoteUpdate platformRemoteUpdate) { |
| | | mongoTemplate.save(platformRemoteUpdate); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRemoteUpdate findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRemoteUpdate.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRemoteUpdate> findAll() { |
| | | return mongoTemplate.findAll(PlatformRemoteUpdate.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformRestart; |
| | | import com.ruoyi.integration.mongodb.service.PlatformRestartService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformRestartServiceImpl implements PlatformRestartService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformRestart platformRestart) { |
| | | mongoTemplate.save(platformRestart); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformRestart findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformRestart.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformRestart> findAll() { |
| | | return mongoTemplate.findAll(PlatformRestart.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStartChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingServiceImpl implements PlatformStartChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStartCharging platformStartCharging) { |
| | | mongoTemplate.save(platformStartCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartCharging.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStopChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStopChargingServiceImpl implements PlatformStopChargingService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(PlatformStopCharging platformStopCharging) { |
| | | mongoTemplate.save(platformStopCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStopCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStopCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStopCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStopCharging.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.mongodb.service.PongService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class PongServiceImpl implements PongService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Pong pong) { |
| | | mongoTemplate.save(pong); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Pong findById(String id) { |
| | | return mongoTemplate.findById(id, Pong.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Pong> findAll() { |
| | | return mongoTemplate.findAll(Pong.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.QueryOfflineCard; |
| | | import com.ruoyi.integration.mongodb.service.QueryOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class QueryOfflineCardServiceImpl implements QueryOfflineCardService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(QueryOfflineCard queryOfflineCard) { |
| | | mongoTemplate.save(queryOfflineCard); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QueryOfflineCard findById(String id) { |
| | | return mongoTemplate.findById(id, QueryOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueryOfflineCard> findAll() { |
| | | return mongoTemplate.findAll(QueryOfflineCard.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.ReadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ReadRealTimeMonitoringDataServiceImpl implements ReadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ReadRealTimeMonitoringData readRealTimeMonitoringData) { |
| | | mongoTemplate.save(readRealTimeMonitoringData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ReadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, ReadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ReadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(ReadRealTimeMonitoringData.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.SetupBillingModel; |
| | | import com.ruoyi.integration.mongodb.service.SetupBillingModelService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class SetupBillingModelServiceImpl implements SetupBillingModelService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(SetupBillingModel setupBillingModel) { |
| | | mongoTemplate.save(setupBillingModel); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SetupBillingModel findById(String id) { |
| | | return mongoTemplate.findById(id, SetupBillingModel.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SetupBillingModel> findAll() { |
| | | return mongoTemplate.findAll(SetupBillingModel.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.SynchronizeOfflineCard; |
| | | import com.ruoyi.integration.mongodb.service.SynchronizeOfflineCardService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class SynchronizeOfflineCardServiceImpl implements SynchronizeOfflineCardService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(SynchronizeOfflineCard synchronizeOfflineCard) { |
| | | mongoTemplate.save(synchronizeOfflineCard); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SynchronizeOfflineCard findById(String id) { |
| | | return mongoTemplate.findById(id, SynchronizeOfflineCard.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SynchronizeOfflineCard> findAll() { |
| | | return mongoTemplate.findAll(SynchronizeOfflineCard.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.TimingSetting; |
| | | import com.ruoyi.integration.mongodb.service.TimingSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TimingSettingServiceImpl implements TimingSettingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(TimingSetting timingSetting) { |
| | | mongoTemplate.save(timingSetting); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public TimingSetting findById(String id) { |
| | | return mongoTemplate.findById(id, TimingSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<TimingSetting> findAll() { |
| | | return mongoTemplate.findAll(TimingSetting.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.UpdateBalance; |
| | | import com.ruoyi.integration.mongodb.service.UpdateBalanceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UpdateBalanceServiceImpl implements UpdateBalanceService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(UpdateBalance updateBalance) { |
| | | mongoTemplate.save(updateBalance); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public UpdateBalance findById(String id) { |
| | | return mongoTemplate.findById(id, UpdateBalance.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<UpdateBalance> findAll() { |
| | | return mongoTemplate.findAll(UpdateBalance.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.WorkingParameterSetting; |
| | | import com.ruoyi.integration.mongodb.service.WorkingParameterSettingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class WorkingParameterSettingServiceImpl implements WorkingParameterSettingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(WorkingParameterSetting workingParameterSetting) { |
| | | mongoTemplate.save(workingParameterSetting); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public WorkingParameterSetting findById(String id) { |
| | | return mongoTemplate.findById(id, WorkingParameterSetting.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorkingParameterSetting> findAll() { |
| | | return mongoTemplate.findAll(WorkingParameterSetting.class); |
| | | } |
| | | } |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringCloud Loadbalancer --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-loadbalancer</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Swagger UI --> |
| | | <dependency> |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @ServletComponentScan |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiOrderApplication { |
| | | public static void main(String[] args) { |
| | |
| | | tExchangeOrder.setCreateTime(LocalDateTime.now()); |
| | | tExchangeOrder.setDelFlag(false); |
| | | exchangeOrderService.save(tExchangeOrder); |
| | | return R.ok(); |
| | | return R.ok(tExchangeOrder.getId()); |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | |
| | | List<MyShoppingOrderList> list = shoppingOrderService.getNoInvoicedOrder(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | // @PostMapping("/create") |
| | | // public R<Long> shopCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | // TShoppingOrder shoppingOrder = new TShoppingOrder(); |
| | | // shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); |
| | | // shoppingOrder.setAppUserId(exchangeDto.getUserId()); |
| | | // shoppingOrder.setOrderType(exchangeDto.getGoodType()); |
| | | // if (exchangeDto.getGoodType()==1) { |
| | | // shoppingOrder.setGoodsId(exchangeDto.getGoodId()); |
| | | // }else { |
| | | // shoppingOrder.setCouponId(exchangeDto.getGoodId()); |
| | | // } |
| | | // shoppingOrder.setPurchaseQuantity(exchangeDto.getNum()); |
| | | // shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); |
| | | // shoppingOrder.setOrderAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setAppCouponId(0L); |
| | | // shoppingOrder.setCouponDiscountAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setVipDiscount(new BigDecimal("0")); |
| | | // shoppingOrder.setVipDiscountAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setPaymentAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setPaymentStatus(0); |
| | | // shoppingOrder.setPaymentType(0); |
| | | // shoppingOrder.setSerialNumber(""); |
| | | // shoppingOrder.setRemark(""); |
| | | // shoppingOrder.setStatus(0); |
| | | // shoppingOrder.setExpressCompany(""); |
| | | // shoppingOrder.setExpressNumber(""); |
| | | // shoppingOrder.setConsignerId(0); |
| | | // shoppingOrder.setConsignerTime(LocalDateTime.now()); |
| | | // shoppingOrder.setReceivingTime(LocalDateTime.now()); |
| | | // shoppingOrder.setCancellationTime(LocalDateTime.now()); |
| | | // shoppingOrder.setCancellationId(0); |
| | | // shoppingOrder.setRefundCode(""); |
| | | // shoppingOrder.setRefundAmount(new BigDecimal("0")); |
| | | // shoppingOrder.setRefundStatus(0); |
| | | // shoppingOrder.setRefundSerialNumber(""); |
| | | // shoppingOrder.setRefundTime(LocalDateTime.now()); |
| | | // shoppingOrder.setCreateTime(LocalDateTime.now()); |
| | | // shoppingOrder.setDelFlag(false); |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.order.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | TAppUser appUser = appUserClient.getUserById(Long.valueOf(userid)).getData(); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringCloud Loadbalancer --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-loadbalancer</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Swagger UI --> |
| | | <dependency> |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @ServletComponentScan |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiOtherApplication { |
| | | public static void main(String[] args) { |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "商品列表分页查询") |
| | | @PostMapping(value = "/app/pageList") |
| | | public AjaxResult<PageInfo<TGoods>> apppageList(BasePage basePage) { |
| | | return AjaxResult.ok(goodsService.pageList1(basePage)); |
| | | public AjaxResult<PageInfo<TGoods>> apppageList(@RequestBody AppGoodQuery appGoodQuery) { |
| | | return AjaxResult.ok(goodsService.pageList1(appGoodQuery)); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "兑换商品") |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | | //检查当前用户积分是否够 |
| | |
| | | } |
| | | exchangeDto.setPoint(point); |
| | | //生成积分兑换成功的订单 |
| | | orderClient.exchangeCreate(exchangeDto); |
| | | R<Long> longR = orderClient.exchangeCreate(exchangeDto); |
| | | if (exchangeDto.getGoodType()==2) { |
| | | //如果是优惠卷,赠送优惠卷给用户 |
| | | GrantCouponDto grantCouponDto = new GrantCouponDto(); |
| | |
| | | appCouponClient.grantCoupon(grantCouponDto); |
| | | } |
| | | //生成消耗积分的记录 |
| | | |
| | | |
| | | |
| | | PointChangeDto pointChangeDto = new PointChangeDto(); |
| | | pointChangeDto.setUserId(userId); |
| | | pointChangeDto.setPoints(point); |
| | | pointChangeDto.setRemark(longR.getData().toString()); |
| | | pointChangeDto.setType(6); |
| | | appUserClient.change(pointChangeDto); |
| | | return AjaxResult.success(); |
| | | |
| | | |
| | | } |
| | | |
| | | // @ApiOperation(tags = {"小程序-兑换商城"},value = "支付商品") |
| | | // @PostMapping(value = "/app/pay") |
| | | // public AjaxResult<PageInfo<TGoods>> pay(@RequestBody ExchangeDto exchangeDto) { |
| | | // |
| | | // //创建订单 |
| | | // |
| | | // //计算价格 |
| | | // |
| | | // //调起支付 |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取商品信息 |
| | |
| | | |
| | | |
| | | @GetMapping("/getSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "获取积分设置") |
| | | @ApiOperation(tags = {"管理后台-积分管理","小程序-个人中心-签到"},value = "获取积分设置") |
| | | public R<TIntegralRule> getSet() { |
| | | TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>()); |
| | | return R.ok(res); |
New file |
| | |
| | | package com.ruoyi.other.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | TAppUser appUser = appUserClient.getUserById(Long.valueOf(userid)).getData(); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TActivity; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | |
| | | public interface TGoodsMapper extends BaseMapper<TGoods> { |
| | | |
| | | List<TGoods> pageList(@Param("pageInfo")PageInfo<TGoods> pageInfo, @Param("req") GoodsDTO dto); |
| | | List<TGoods> pageList1(@Param("pageInfo")PageInfo<TGoods> pageInfo); |
| | | List<TGoods> pageList1(@Param("pageInfo")PageInfo<TGoods> pageInfo, @Param("appGoodQuery")AppGoodQuery appGoodQuery); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | |
| | | public interface TGoodsService extends IService<TGoods> { |
| | | |
| | | PageInfo<TGoods> pageList(GoodsDTO dto); |
| | | PageInfo<TGoods> pageList1(BasePage basePage); |
| | | PageInfo<TGoods> pageList1(AppGoodQuery appGoodQuery); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public PageInfo<TGoods> pageList1(BasePage basePage) { |
| | | public PageInfo<TGoods> pageList1(AppGoodQuery basePage) { |
| | | GoodsDTO dto = new GoodsDTO(); |
| | | dto.setType(2); |
| | | dto.setStatus(1); |
| | | dto.setPageCurr(basePage.getPageCurr()); |
| | | dto.setPageSize(basePage.getPageSize()); |
| | | PageInfo<TGoods> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TGoods> list = this.baseMapper.pageList1(pageInfo); |
| | | List<TGoods> list = this.baseMapper.pageList1(pageInfo,basePage); |
| | | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (TGoods temp : list) { |
| | |
| | | import com.ruoyi.other.mapper.TVipMapper; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | for (TVip tVip : list) { |
| | | String coupon = tVip.getCoupon(); |
| | | if (StringUtils.hasLength(coupon)){ |
| | | JSONArray jsonArray = JSONObject.parseArray(coupon); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | |
| | | } |
| | | tVip.setCouponName(stringBuilder.toString()); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> |
| | | select * from t_goods |
| | | <where> |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | SELECT |
| | | id,name,redeem_points,inventory |
| | | FROM |
| | | t_goods |
| | | WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | | UNION ALL |
| | | SELECT |
| | | id,name,redeem_points,inventory_quantity as inventory |
| | | FROM |
| | | t_coupon |
| | | WHERE `status`= 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | | ORDER BY |
| | | CASE WHEN `inventory` = 0 THEN 0 ELSE 1 END DESC, |
| | | CASE |
| | | |
| | | WHEN `inventory` = 0 THEN |
| | | 0 ELSE 1 |
| | | END DESC, |
| | | `redeem_points` ASC; |
| | | </select> |
| | | |
| | |
| | | <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot Actuator --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringCloud Loadbalancer --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-loadbalancer</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Swagger UI --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | |
| | | public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception { |
| | | try { |
| | | Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {}); |
| | | String outRefundNo = (String) params.get("out_refund_no"); |
| | | String substring = outRefundNo.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | //更改订单状态 |
| | | //如果是优惠卷赠送优惠卷 |
| | | break; |
| | | } |
| | | |
| | | log.info("支付回调:{}", params); |
| | | return R.ok(params); |
| | | } catch (Exception e) { |