1、原SsoAop进行登录验证有鉴权,现改为只验证登录,不做鉴权,相应SsoCtrl中增加只鉴权的方法
2、优化通信中间件代码、common模块中协议代码、
| | |
| | | @Target(ElementType.METHOD) |
| | | @Inherited |
| | | public @interface SsoAop { |
| | | String value() default "" ; |
| | | //优先级1(最高),如果其有值,则不在判断以下变量取值 |
| | | String power() default "" ; |
| | | //优先级2,拥有全部权限才可 , 如果其有值,则不在判断以下变量取值 |
| | | String[] ifAllPower() default{""} ; |
| | | //优先级3 , 如果有一个权限即可 , 如果其有值,则不在判断以下变量取值 |
| | | String[] ifAnyPower() default{""} ; |
| | | } |
| | |
| | | public String isDevStage ;//是否为开发阶段 |
| | | |
| | | @Value("${pipIrr.sso.checkUrl}") |
| | | public String SsoCheckUrl ; |
| | | public String ssoCheckUrl; |
| | | |
| | | private RestTemplate restTemplate; |
| | | |
| | |
| | | } |
| | | |
| | | @Pointcut("@annotation(com.dy.common.aop.SsoAop)") |
| | | public void dyPointCut() { |
| | | public void ssoPointCut() { |
| | | } |
| | | |
| | | @Around("dyPointCut()") |
| | | @Around("ssoPointCut()") |
| | | public Object execute(ProceedingJoinPoint point) throws Throwable { |
| | | if(isDevStage != null && !isDevStage.trim().equals("") && isDevStage.trim().equalsIgnoreCase("true")){ |
| | | return point.proceed(); |
| | |
| | | Method method = signature.getMethod(); |
| | | SsoAop aop = method.getAnnotation(SsoAop.class) ; |
| | | if (Objects.nonNull(aop)){ |
| | | String power = aop.value() ; |
| | | if(power.trim().equals("")){ |
| | | power = aop.power() ; |
| | | } |
| | | if(power.trim().equals("-1")){ |
| | | //不进行登录及权限验证 |
| | | return point.proceed(); |
| | | }else{ |
| | | String[] allPower = aop.ifAllPower() ; |
| | | String[] anyPower = aop.ifAnyPower() ; |
| | | String token = UserTokenContext.get() ; |
| | | Object rObj = this.check(token, power, allPower, anyPower); |
| | | Object rObj = this.check(token); |
| | | if(rObj != null){ |
| | | if(rObj instanceof SsoVo ssoVo){ |
| | | if(ssoVo.logined){ |
| | |
| | | }else{ |
| | | return BaseResponseUtils.buildError("后端系统出错,check方法返回null") ; |
| | | } |
| | | } |
| | | }else{ |
| | | //已经进入注解处理了,还得不到注解,这种情况是不可能的。 |
| | | return BaseResponseUtils.buildError("后端系统出错,DyAop注解为null") ; |
| | |
| | | /** |
| | | * 调用SSO系统进行验证 |
| | | * @param token Header中的用户token |
| | | * @param power 一个权限 |
| | | * @param allPower 多个权限 |
| | | * @param anyPower 多个权限 |
| | | * @return 返回对象 |
| | | */ |
| | | private Object check(String token, String power, String[] allPower, String[] anyPower){ |
| | | if(!StringUtils.isNullOrEmpty(SsoCheckUrl)){ |
| | | String url = UriComponentsBuilder.fromUriString(SsoCheckUrl) |
| | | private Object check(String token){ |
| | | if(!StringUtils.isNullOrEmpty(ssoCheckUrl)){ |
| | | String url = UriComponentsBuilder.fromUriString(ssoCheckUrl) |
| | | .queryParam("token", token) |
| | | .queryParam("power", power) |
| | | .queryParam("allPower", (Object) allPower) |
| | | .queryParam("anyPower", (Object) anyPower) |
| | | .build() |
| | | .toUriString(); |
| | | // 由于获取student接口咱们设置了basicauth,所以需要在请求时配置 |
New file |
| | |
| | | package com.dy.common.aop; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.METHOD) |
| | | @Inherited |
| | | public @interface SsoPowerAop { |
| | | String value() default "" ; |
| | | //优先级1(最高),如果其有值,则不在判断以下变量取值 |
| | | String power() default "" ; |
| | | //优先级2,拥有全部权限才可 , 如果其有值,则不在判断以下变量取值 |
| | | String[] ifAllPower() default{""} ; |
| | | //优先级3 , 如果有一个权限即可 , 如果其有值,则不在判断以下变量取值 |
| | | String[] ifAnyPower() default{""} ; |
| | | } |
New file |
| | |
| | | package com.dy.common.aop; |
| | | |
| | | import com.dy.common.contant.Constant; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.webFilter.UserTokenContext; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.util.UriComponentsBuilder; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Aspect |
| | | @Order(Constant.AspectOrderSsoAutho) |
| | | @Component |
| | | public class SsoPowerAspect { |
| | | |
| | | @Value("${pipIrr.global.dev}") |
| | | public String isDevStage ;//是否为开发阶段 |
| | | |
| | | @Value("${pipIrr.sso.checkUrl}") |
| | | public String SsoCheckUrl ; |
| | | |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | public void setRestTemplate(RestTemplate restTemplate){ |
| | | this.restTemplate = restTemplate ; |
| | | } |
| | | |
| | | @Pointcut("@annotation(com.dy.common.aop.SsoPowerAop)") |
| | | public void ssoPowerPointCut() { |
| | | } |
| | | |
| | | @Around("ssoPowerPointCut()") |
| | | public Object execute(ProceedingJoinPoint point) throws Throwable { |
| | | if(isDevStage != null && !isDevStage.trim().equals("") && isDevStage.trim().equalsIgnoreCase("true")){ |
| | | return point.proceed(); |
| | | }else{ |
| | | MethodSignature signature = (MethodSignature) point.getSignature(); |
| | | Method method = signature.getMethod(); |
| | | SsoPowerAop aop = method.getAnnotation(SsoPowerAop.class) ; |
| | | if (Objects.nonNull(aop)){ |
| | | String power = aop.value() ; |
| | | if(power.trim().equals("")){ |
| | | power = aop.power() ; |
| | | } |
| | | if(power.trim().equals("-1")){ |
| | | //不进行登录及权限验证 |
| | | return point.proceed(); |
| | | }else{ |
| | | String[] allPower = aop.ifAllPower() ; |
| | | String[] anyPower = aop.ifAnyPower() ; |
| | | String token = UserTokenContext.get() ; |
| | | Object rObj = this.check(token, power, allPower, anyPower); |
| | | if(rObj != null){ |
| | | if(rObj instanceof SsoVo ssoVo){ |
| | | if(ssoVo.logined){ |
| | | if(ssoVo.hasPower){ |
| | | if(!StringUtils.isNullOrEmpty(ssoVo.dataSourceName)){ |
| | | DataSourceContext.set(ssoVo.dataSourceName); |
| | | Object obj = point.proceed(); |
| | | DataSourceContext.remove(); |
| | | return obj ; |
| | | }else{ |
| | | //无数据源 |
| | | return BaseResponseUtils.buildError("后端系统出错,未得到当前登录用户所属机构标签(数据源名)") ; |
| | | } |
| | | }else{ |
| | | //无权限 |
| | | return BaseResponseUtils.buildNoPower() ; |
| | | } |
| | | }else{ |
| | | //未登录 |
| | | return BaseResponseUtils.buildToLogin() ; |
| | | } |
| | | }else{ |
| | | return rObj ; |
| | | } |
| | | }else{ |
| | | return BaseResponseUtils.buildError("后端系统出错,check方法返回null") ; |
| | | } |
| | | } |
| | | }else{ |
| | | //已经进入注解处理了,还得不到注解,这种情况是不可能的。 |
| | | return BaseResponseUtils.buildError("后端系统出错,DyAop注解为null") ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 调用SSO系统进行验证 |
| | | * @param token Header中的用户token |
| | | * @param power 一个权限 |
| | | * @param allPower 多个权限 |
| | | * @param anyPower 多个权限 |
| | | * @return 返回对象 |
| | | */ |
| | | private Object check(String token, String power, String[] allPower, String[] anyPower){ |
| | | if(!StringUtils.isNullOrEmpty(SsoCheckUrl)){ |
| | | String url = UriComponentsBuilder.fromUriString(SsoCheckUrl) |
| | | .queryParam("token", token) |
| | | .queryParam("power", power) |
| | | .queryParam("allPower", (Object) allPower) |
| | | .queryParam("anyPower", (Object) anyPower) |
| | | .build() |
| | | .toUriString(); |
| | | // 由于获取student接口咱们设置了basicauth,所以需要在请求时配置 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | HttpEntity<?> httpEntity = new HttpEntity<>(headers); |
| | | ResponseEntity<SsoVo> response = null; |
| | | try { |
| | | // 通过Get方式调用接口 |
| | | response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, SsoVo.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | assert response != null; |
| | | return response.getBody(); |
| | | }else { |
| | | return BaseResponseUtils.buildError("后端系统出错,未得到SsoCheckUrl"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @Builder |
| | | public class SsoVo { |
| | | public boolean logined ; |
| | | public boolean hasPower ; |
| | | public boolean hasPower ;//2023-12-21 经商议,由前端鉴权,所以此属性不再应用 |
| | | public String dataSourceName ; |
| | | } |
| | |
| | | public String id; |
| | | |
| | | /** |
| | | * 水表协议名称,这个可以为空,因为水表上行数据解析出协议名称,然后系统把协议名称保存在水表数据记录中,从此协议名称就不再空了 |
| | | * RTU协议名称,这个可以为空,因为RTU上行数据解析出协议名称,然后系统把协议名称保存在RTU数据记录中,从此协议名称就不再空了 |
| | | */ |
| | | public String protocol; |
| | | |
| | |
| | | public class CodeV1_0_1 { |
| | | //功能码为字符串,十六进制数据 |
| | | public static final String cd_02 = "02" ;//遥测站链路检测 |
| | | public static final String cd_C0 = "C0" ;//遥测站自报实时数据 |
| | | public static final String cd_71 = "71" ;//查询阀门状态(李天赐制定的协议,当前未实现) |
| | | public static final String cd_83 = "83" ;//遥测站开关阀自报 |
| | | public static final String cd_84 = "84" ;//开阀工作报 |
| | | public static final String cd_71 = "71" ;//查询阀门状态 |
| | | public static final String cd_C0 = "C0" ;//遥测站自报实时数据 |
| | | |
| | | public static String getCodeName(String code) { |
| | | String name = (code.equals(cd_02) ? "链路检测" : |
| | | (code.equals(cd_C0) ? "自报实时数据" : |
| | | (code.equals(cd_71) ? "查询阀门状态" : |
| | | (code.equals(cd_83) ? "开关阀自报" : |
| | | (code.equals(cd_84) ? "开阀工作报" : |
| | | (code.equals(cd_71) ? "查询阀门状态" : |
| | | (code.equals(cd_C0) ? "自报实时数据" : |
| | | ""))))) ; |
| | | return name ; |
| | | } |
| | |
| | | case 7 -> "紧急关阀"; |
| | | case 8 -> "用户远程开阀"; |
| | | case 9 -> "用户远程关阀"; |
| | | case 16 -> "管道无水自动关阀"; |
| | | default -> "未知"; |
| | | }; |
| | | } |
| | |
| | | // 开关阀类型: |
| | | // 1、刷卡开阀;2刷卡关阀;3、中心站开阀;4、中心站关阀;5、欠费关阀; |
| | | // 6、流量计故障关阀;7、紧急关阀;8、用户远程开阀;9、用户远程关阀; |
| | | // 16,用户开阀后管道内没有水,自动关阀。管道不出水自动关阀 |
| | | public Byte type ; |
| | | public Double totalAmount; //累计流量:5字节BCD码,取值范围0~9999999999,单位为m3。 |
| | | public String clientNum ;//农户编号 |
| | |
| | | package com.dy.common.util; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.KeyManagementException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.cert.X509Certificate; |
| | |
| | | /** |
| | | * get |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doGet(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys) throws Exception { |
| | | Map<String, String> params) throws Exception{ |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpGet request = new HttpGet(buildUrl(host, path, querys)); |
| | | HttpGet request = new HttpGet(buildUrl(host, path, params)); |
| | | if(headers != null){ |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | |
| | | /** |
| | | * post form |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @param bodys |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @param bodies 请求体 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doPost(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys, Map<String, String> bodys) throws Exception { |
| | | Map<String, String> params, Map<String, String> bodies) throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPost request = new HttpPost(buildUrl(host, path, querys)); |
| | | HttpPost request = new HttpPost(buildUrl(host, path, params)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | if (bodys != null) { |
| | | List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>(); |
| | | if (bodies != null) { |
| | | List<NameValuePair> nameValuePairList = new ArrayList<>(); |
| | | |
| | | for (String key : bodys.keySet()) { |
| | | nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); |
| | | for (String key : bodies.keySet()) { |
| | | nameValuePairList.add(new BasicNameValuePair(key, bodies.get(key))); |
| | | } |
| | | UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); |
| | | formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); |
| | |
| | | /** |
| | | * Post String |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @param body 请求体 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doPost(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys, String body) throws Exception { |
| | | Map<String, String> params, String body) throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPost request = new HttpPost(buildUrl(host, path, querys)); |
| | | HttpPost request = new HttpPost(buildUrl(host, path, params)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | |
| | | /** |
| | | * Post stream |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @param body 请求体 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doPost(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys, byte[] body) throws Exception { |
| | | Map<String, String> params, byte[] body) throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPost request = new HttpPost(buildUrl(host, path, querys)); |
| | | HttpPost request = new HttpPost(buildUrl(host, path, params)); |
| | | if(headers != null){ |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | |
| | | /** |
| | | * Put String |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @param body 请求体 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doPut(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys, String body) throws Exception { |
| | | Map<String, String> params, String body) throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPut request = new HttpPut(buildUrl(host, path, querys)); |
| | | HttpPut request = new HttpPut(buildUrl(host, path, params)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | |
| | | /** |
| | | * Put stream |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @param body 请求体 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doPut(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys, byte[] body) throws Exception { |
| | | Map<String, String> params, byte[] body) throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPut request = new HttpPut(buildUrl(host, path, querys)); |
| | | HttpPut request = new HttpPut(buildUrl(host, path, params)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | |
| | | /** |
| | | * Delete |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param headers |
| | | * @param querys |
| | | * @return |
| | | * @throws Exception |
| | | * @param host 服务端URI |
| | | * @param path 请求路径 |
| | | * @param headers 请求头 |
| | | * @param params 请求参数 |
| | | * @return HttpResponse响应 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public static HttpResponse doDelete(String host, String path, Map<String, String> headers, |
| | | Map<String, String> querys) throws Exception { |
| | | Map<String, String> params) throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); |
| | | HttpDelete request = new HttpDelete(buildUrl(host, path, params)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | private static String buildUrl(String host, String path, Map<String, String> querys) |
| | | throws UnsupportedEncodingException { |
| | | private static String buildUrl(String host, String path, Map<String, String> params) { |
| | | StringBuilder sbUrl = new StringBuilder(); |
| | | sbUrl.append(host); |
| | | if (!StringUtils.isBlank(path)) { |
| | | sbUrl.append(path); |
| | | } |
| | | if (null != querys) { |
| | | if (null != params) { |
| | | StringBuilder sbQuery = new StringBuilder(); |
| | | for (Map.Entry<String, String> query : querys.entrySet()) { |
| | | for (Map.Entry<String, String> query : params.entrySet()) { |
| | | if (0 < sbQuery.length()) { |
| | | sbQuery.append("&"); |
| | | } |
| | |
| | | sbQuery.append(query.getKey()); |
| | | if (!StringUtils.isBlank(query.getValue())) { |
| | | sbQuery.append("="); |
| | | sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); |
| | | sbQuery.append(URLEncoder.encode(query.getValue(), StandardCharsets.UTF_8)); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.net.InetSocketAddress; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Hashtable; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map.Entry; |
| | |
| | | //缓存session |
| | | TcpSessionCache.putNewTcpSession(rtuAddr, protocolName, session); |
| | | |
| | | log.info("RTU(地址:" + rtuAddr + ")上线了。") ; |
| | | log.info("RTU(地址:" + rtuAddr + ",协议:" + protocolName + ")上线了。") ; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.aceMw.web.com; |
| | | |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2023/12/21 13:58 |
| | | * @LastEditTime 2023/12/21 13:58 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping(path="com") |
| | | @SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked") |
| | | public class CommandCtrl { |
| | | |
| | | @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | public BaseResponse<Command> send(@RequestBody Command com) { |
| | | return BaseResponseUtils.buildSuccess(com); |
| | | } |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> all(){ |
| | | try { |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectAll() ; |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo) ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaBlock> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaBlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaBlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClient>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaClient>> res = this.sv.selectSome(vo) ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaClient> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClientType>>> all(){ |
| | | try { |
| | | QueryResultVo<List<BaClientType>> res = this.sv.selectAll() ; |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaClientType> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<List<BaDistrict>> all(){ |
| | | List<BaDistrict> list = this.sv.selectAllByLevel(DistrictLevel.City.code) ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaDistrict> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaDivide>>> all(){ |
| | | try { |
| | | QueryResultVo<List<BaDivide>> res = this.sv.selectAll() ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaDivide> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaDivide>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) DivideVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaDivide>> res = this.sv.selectSome(vo) ; |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> all(){ |
| | | try { |
| | | QueryResultVo<List<BaRole>> res = this.sv.selectAll() ; |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<BaRole>> res = this.sv.selectSome(vo) ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaRole> one(@Parameter(description = "实体id", required = true) Long id){ |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "setPrivs", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> setPrivileges(@Parameter(description = "实体id", required = true) Long id, |
| | | @Parameter(description = "权限id数组") Long[] privIds){ |
| | | Long[] privIds_lg = null ; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody @Parameter(description = "查询form表单json数据", required = true) @Valid QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<BaUser> one(@Parameter(description = "实体id", required = true) String id) { |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id))); |
| | | } |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid BaUser po, @Parameter(hidden = true) BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> changePassword(@Parameter(description = "实体id", required = true) String id, |
| | | @Parameter(description = "旧密码", required = true) String oldPassword, |
| | | @Parameter(description = "新密码", required = true) String newPassword) throws Exception { |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody @Parameter(description = "form表单json数据", required = true) ResetPasswordVo vo) throws Exception { |
| | | if (vo.id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "resetPasswordByDefault", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPasswordByDefault(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "resetPasswordByRandom", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<String> resetPasswordByRandom(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "setRoles", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> setRoles(@Parameter(description = "实体id", required = true) String id, |
| | | @Parameter(description = "角色id数组") String[] roleIds) { |
| | | Long[] roleId_lg = null; |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(@Parameter(description = "实体id", required = true) String id) { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getActiveCards", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoActiveCard>>> getActiveCards(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoActiveCard>> res = activeCardSv.getActiveCards(vo); |
| | |
| | | }) |
| | | @PostMapping(path = "add_active", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | }) |
| | | @PostMapping(path = "add_reissue", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getCancels", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCancel>>> getCancels(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoCancel>> res = cancelSv.getCancels(vo); |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoCancel po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getLosses", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoLoss>>> getLosses(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoLoss>> res = lossSv.getLosses(vo); |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoLoss po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get") |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<SePaymentMethod>>> getPaymentMethods(){ |
| | | try { |
| | | QueryResultVo<List<SePaymentMethod>> res = paymentMethodSv.getPaymentMethods(); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getRecharges", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoRecharge>>> get(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoRecharge>> res = rechargeSv.getRecharges(vo); |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getReversals", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoReversal>>> getReversals(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoReversal>> res = reversalSv.getReversals(vo); |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoReversal po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/getUnlocks", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop("-1") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoUnlock>>> getUnlocks(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ |
| | | try { |
| | | QueryResultVo<List<VoUnlock>> res = unlockSv.getUnlocks(vo); |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoUnlock po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | }) |
| | | @PostMapping(path = "add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | //public BaseResponse<Boolean> add(@RequestBody Long clientId){ |
| | | public BaseResponse<Boolean> add(@RequestParam("clientId") @NotNull(message = "农户编号不能为空") Long clientId){ |
| | | if(clientId == null || clientId < 0) { |
| | |
| | | //}) |
| | | //@PostMapping(path = "addRecharge") |
| | | //@Transactional(rollbackFor = Exception.class) |
| | | //@SsoAop("-1")//@SsoAop(power = "-1") |
| | | //@SsoAop() |
| | | //public BaseResponse<Boolean> addRecharge(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoWalletRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | BaUser userPo = this.sv.getByUuid(token) ; |
| | | return userPo == null ? null : userPo.id ; |
| | | } |
| | | |
| | | /** |
| | | * 此方法供子模块系统调用,所以不公开在API接口中 |
| | | * 方法功能:验证是否已经登录,如果登录了,再验证权限 |
| | | * @param token 登录用户token |
| | | * @return SsoVo |
| | | */ |
| | | @Hidden |
| | | @GetMapping(path = "ssoCheck") |
| | | public SsoVo ssoCheck(String token){ |
| | | BaUser userPo = this.sv.getByUuid(token) ; |
| | | SsoVo vo = new SsoVo(); |
| | | if(userPo != null){ |
| | | vo.dataSourceName = userPo.orgTag ; |
| | | vo.logined = true ; |
| | | vo.hasPower = true ;//默认有权限 |
| | | }else{ |
| | | vo.logined = false ; |
| | | vo.hasPower = true ;//默认有权限 |
| | | } |
| | | return vo ; |
| | | } |
| | | /** |
| | | * 此方法供子模块系统调用,所以不公开在API接口中 |
| | | * 方法功能:验证是否已经登录,如果登录了,再验证权限 |