diff --git a/review_repo/src/main/java/com/zcloud/MainApplication.java b/review_repo/src/main/java/com/zcloud/MainApplication.java new file mode 100644 index 0000000..921645f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/MainApplication.java @@ -0,0 +1,15 @@ +package com.zcloud; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + + +@SpringBootApplication +public class MainApplication { + + public static void main(String[] args) { + SpringApplication.run(MainApplication.class, args); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/SpringBootStartApplication.java b/review_repo/src/main/java/com/zcloud/SpringBootStartApplication.java new file mode 100644 index 0000000..b61e0a1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/SpringBootStartApplication.java @@ -0,0 +1,15 @@ +package com.zcloud; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * 说明:项目以war包方式运行时用到 + */ +public class SpringBootStartApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return builder.sources(MainApplication.class); //这里要指向原先用main方法执行的FHmainApplication启动类 + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/annotation/SysLog.java b/review_repo/src/main/java/com/zcloud/common/annotation/SysLog.java new file mode 100644 index 0000000..85c316b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/annotation/SysLog.java @@ -0,0 +1,15 @@ +package com.zcloud.common.annotation; + +import java.lang.annotation.*; + +/** + * 系统日志注解 + * + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface SysLog { + String value() default ""; +} diff --git a/review_repo/src/main/java/com/zcloud/common/aspect/RedisAspect.java b/review_repo/src/main/java/com/zcloud/common/aspect/RedisAspect.java new file mode 100644 index 0000000..6c40067 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/aspect/RedisAspect.java @@ -0,0 +1,40 @@ + + +package com.zcloud.common.aspect; + +import com.zcloud.common.exception.ZException; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +/** + * Redis切面处理类 + * + * + */ +@Aspect +@Configuration +public class RedisAspect { + private Logger logger = LoggerFactory.getLogger(getClass()); + //是否开启redis缓存 true开启 false关闭 + @Value("${spring.redis.open: false}") + private boolean open; + + @Around("execution(* com.zcloud.common.utils.RedisUtils.*(..))") + public Object around(ProceedingJoinPoint point) throws Throwable { + Object result = null; + if(open){ + try{ + result = point.proceed(); + }catch (Exception e){ + logger.error("redis error", e); + throw new ZException("Redis服务异常"); + } + } + return result; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/aspect/SysLogAspect.java b/review_repo/src/main/java/com/zcloud/common/aspect/SysLogAspect.java new file mode 100644 index 0000000..715827c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/aspect/SysLogAspect.java @@ -0,0 +1,93 @@ + + +package com.zcloud.common.aspect; +import com.google.gson.Gson; +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.HttpContextUtils; +import com.zcloud.common.utils.IPUtils; +import com.zcloud.modules.sys.entity.SysLogEntity; +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.service.SysLogService; +import org.apache.shiro.SecurityUtils; +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.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.util.Date; + +/** + * 系统日志,切面处理类 + * + */ +@Aspect +@Component +public class SysLogAspect { + @Autowired + private SysLogService sysLogService; + + @Pointcut("@annotation(com.zcloud.common.annotation.SysLog)") + public void logPointCut() { + + } + + @Around("logPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + long beginTime = System.currentTimeMillis(); + //执行方法 + Object result = point.proceed(); + //执行时长(毫秒) + long time = System.currentTimeMillis() - beginTime; + + //保存日志 + saveSysLog(point, time); + + return result; + } + + private void saveSysLog(ProceedingJoinPoint joinPoint, long time) { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + + SysLogEntity sysLog = new SysLogEntity(); + SysLog syslog = method.getAnnotation(SysLog.class); + if(syslog != null){ + //注解上的描述 + sysLog.setOperation(syslog.value()); + } + + //请求的方法名 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = signature.getName(); + sysLog.setMethod(className + "." + methodName + "()"); + + //请求的参数 + Object[] args = joinPoint.getArgs(); + try{ + String params = new Gson().toJson(args); + sysLog.setParams(params); + }catch (Exception e){ + + } + + //获取request + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + //设置IP地址 + sysLog.setIp(IPUtils.getIpAddr(request)); + + //用户名 + String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername(); + sysLog.setUsername(username); + sysLog.setCorpinfoId(((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getCorpinfoId()); + + sysLog.setTime(time); + sysLog.setCreateDate(new Date()); + //保存系统日志 + sysLogService.saveLog(sysLog); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/exception/ZException.java b/review_repo/src/main/java/com/zcloud/common/exception/ZException.java new file mode 100644 index 0000000..98314ed --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/exception/ZException.java @@ -0,0 +1,54 @@ + + +package com.zcloud.common.exception; + +/** + * 自定义异常 + * + */ +public class ZException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private String msg; + private int code = 500; + + public ZException(String msg) { + super(msg); + this.msg = msg; + } + + public ZException(String msg, Throwable e) { + super(msg, e); + this.msg = msg; + } + + public ZException(String msg, int code) { + super(msg); + this.msg = msg; + this.code = code; + } + + public ZException(String msg, int code, Throwable e) { + super(msg, e); + this.msg = msg; + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/common/exception/ZExceptionHandler.java b/review_repo/src/main/java/com/zcloud/common/exception/ZExceptionHandler.java new file mode 100644 index 0000000..d2cc9cc --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/exception/ZExceptionHandler.java @@ -0,0 +1,55 @@ +package com.zcloud.common.exception; + +import com.zcloud.common.utils.R; +import org.apache.shiro.authz.AuthorizationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.NoHandlerFoundException; + +/** + * 异常处理器 + * + */ +@RestControllerAdvice +public class ZExceptionHandler { + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 处理自定义异常 + */ + @ExceptionHandler(ZException.class) + public R handleRRException(ZException e){ + R r = new R(); + r.put("code", e.getCode()); + r.put("msg", e.getMessage()); + + return r; + } + + @ExceptionHandler(NoHandlerFoundException.class) + public R handlerNoFoundException(Exception e) { + logger.error(e.getMessage(), e); + return R.error(404, "路径不存在,请检查路径是否正确"); + } + + @ExceptionHandler(DuplicateKeyException.class) + public R handleDuplicateKeyException(DuplicateKeyException e){ + logger.error(e.getMessage(), e); + return R.error("数据库中已存在该记录"); + } + + @ExceptionHandler(AuthorizationException.class) + public R handleAuthorizationException(AuthorizationException e){ + logger.error(e.getMessage(), e); + return R.error("没有权限,请联系管理员授权"); + } + + @ExceptionHandler(Exception.class) + public R handleException(Exception e){ + logger.error(e.getMessage(), e); + return R.error(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/handler/MultipartJackson2HttpMessageConverter.java b/review_repo/src/main/java/com/zcloud/common/handler/MultipartJackson2HttpMessageConverter.java new file mode 100644 index 0000000..6f2139b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/handler/MultipartJackson2HttpMessageConverter.java @@ -0,0 +1,34 @@ +package com.zcloud.common.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Type; + +@Component +public class MultipartJackson2HttpMessageConverter extends AbstractJackson2HttpMessageConverter { + + /** + * Converter for support http request with header Content-Type: multipart/form-data + */ + public MultipartJackson2HttpMessageConverter(ObjectMapper objectMapper) { + super(objectMapper, MediaType.APPLICATION_OCTET_STREAM); + } + + @Override + public boolean canWrite(Type type, Class clazz, MediaType mediaType) { + return false; + } + + @Override + public boolean canWrite(Class clazz, MediaType mediaType) { + return false; + } + + @Override + protected boolean canWrite(MediaType mediaType) { + return false; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/handler/MyMetaObjectHandler.java b/review_repo/src/main/java/com/zcloud/common/handler/MyMetaObjectHandler.java new file mode 100644 index 0000000..af31f18 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/handler/MyMetaObjectHandler.java @@ -0,0 +1,26 @@ +package com.zcloud.common.handler; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.zcloud.common.utils.DateUtil; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@Component +public class MyMetaObjectHandler implements MetaObjectHandler { + + + @Override + public void insertFill(MetaObject metaObject) { + this.setFieldValByName("isDelete", 0, metaObject); + this.setFieldValByName("createTime", DateUtil.date2Str(new Date()), metaObject); + this.setFieldValByName("operatTime", DateUtil.date2Str(new Date()), metaObject); + + } + + @Override + public void updateFill(MetaObject metaObject) { + this.setFieldValByName("operatTime", DateUtil.date2Str(new Date()), metaObject); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/handler/PlatVideoHandler.java b/review_repo/src/main/java/com/zcloud/common/handler/PlatVideoHandler.java new file mode 100644 index 0000000..ec49e6a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/handler/PlatVideoHandler.java @@ -0,0 +1,127 @@ +package com.zcloud.common.handler; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zcloud.common.utils.HttpRequestUtil; +import com.zcloud.common.utils.MD5; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import org.apache.commons.lang.StringUtils; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author fangjiakai + * @date 2023/10/19 10:44 + */ +@ConfigurationProperties(prefix = "customer") +@Component +public class PlatVideoHandler { + private String id; + private String secret_key; + private String url; + private String domain; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSecret_key() { + return secret_key; + } + + public void setSecret_key(String secret_key) { + this.secret_key = secret_key; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public PageUtils syncCurList(Map params) { + HashMap request = new HashMap<>(); + request.put("id", id); + String key = MD5.md5(secret_key + domain); + request.put("SECRET_KEY", key); + if(params.get("name")!=null) request.put("KEYWORDS", params.get("name").toString()); + request.put("showCount", params.get("limit").toString()); + request.put("currentPage", params.get("curPage").toString()); + String _response = HttpRequestUtil.doPost(url + "/curriculum/getCurList", JSONObject.toJSONString(request)); + JSONObject responseResult = JSONObject.parseObject(_response); + System.out.println(responseResult); + Page page = new Page(); + page.setRecords(responseResult.getJSONArray("curriculumList")); + page.setTotal(Long.parseLong(responseResult.getJSONObject("page").getString("totalResult"))); + page.setSize(Long.parseLong(params.get("limit").toString())); + page.setCurrent(Long.parseLong(responseResult.getJSONObject("page").getString("currentPage"))); + page.setPages(Long.parseLong(responseResult.getJSONObject("page").getString("totalPage"))); + return new PageUtils(page); + } + + public JSONObject syncCurInfo(Map params) { + HashMap request = new HashMap<>(); + request.put("CURRICULUM_ID", params.get("curriculum_id").toString()); + request.put("id", id); + String key = MD5.md5(secret_key + domain); + request.put("SECRET_KEY", key); + String _response = HttpRequestUtil.doPost(url + "/curriculum/getCurInfo", JSONObject.toJSONString(request)); + JSONObject responseResult = JSONObject.parseObject(_response); + System.out.println(responseResult); + if(responseResult != null && responseResult.get("code") != null && StringUtils.isNotBlank(responseResult.get("code").toString()) && "0".equals(responseResult.get("code"))){ + return responseResult; + } else { + return null; + } + } + + public R syncVideoPlayAuth(Map video) { + HashMap request = new HashMap<>(); + request.put("id", this.id); + request.put("videoId", video.get("video_id_remote").toString()); + request.put("curriculumId", video.get("curriculum_id_remote").toString()); + request.put("type", "0"); + String key = MD5.md5(secret_key + domain); + request.put("SECRET_KEY", key); + String _response = HttpRequestUtil.doPost(url + "/videoCourseware/getPlayInfo", JSONObject.toJSONString(request)); + Map response = JSONObject.parseObject(_response, Map.class); + return R.ok().put("responseBody",response); + } + + /** + * description: 获取视频封面

+ * + * @throws Exception + */ + public Map syncVideoInfo(Map video) { + HashMap request = new HashMap<>(); + request.put("id", id); + request.put("videoId", video.get("videocourseware_id_remote").toString()); + request.put("curriculumId", video.get("curriculum_id_remote").toString()); + request.put("type", "0"); + String key = MD5.md5(secret_key + domain); + request.put("SECRET_KEY", key); + String _response = HttpRequestUtil.doPost(url + "/videoCourseware/getPlayUrl", JSONObject.toJSONString(request)); + Map response = JSONObject.parseObject(_response, Map.class); + return response; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/AesEncryptor.java b/review_repo/src/main/java/com/zcloud/common/utils/AesEncryptor.java new file mode 100644 index 0000000..788a9b2 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/AesEncryptor.java @@ -0,0 +1,152 @@ +package com.zcloud.common.utils; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; +import sun.misc.BASE64Decoder; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.spec.SecretKeySpec; +import java.math.BigInteger; + +/** + * AES的加密和解密 + * @author libo + */ +public class AesEncryptor { + //密钥 (需要前端和后端保持一致) +// private static final String KEY = "qwertyuiqwertyui"; + private static final String KEY = "daac3ae52eff4cec"; + //算法 + private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; + + /** + * aes解密 + * @param encrypt 内容 + * @return + * @throws Exception + */ + public static String aesDecrypt(String encrypt) { + try { + return aesDecrypt(encrypt, KEY); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + /** + * aes加密 + * @param content + * @return + * @throws Exception + */ + public static String aesEncrypt(String content) { + try { + return aesEncrypt(content, KEY); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + /** + * 将byte[]转为各种进制的字符串 + * @param bytes byte[] + * @param radix 可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制 + * @return 转换后的字符串 + */ + public static String binary(byte[] bytes, int radix){ + return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数 + } + + /** + * base 64 encode + * @param bytes 待编码的byte[] + * @return 编码后的base 64 code + */ + public static String base64Encode(byte[] bytes){ + return Base64.encodeBase64String(bytes); + } + + /** + * base 64 decode + * @param base64Code 待解码的base 64 code + * @return 解码后的byte[] + * @throws Exception + */ + public static byte[] base64Decode(String base64Code) throws Exception{ + return StringUtils.isEmpty(base64Code) ? null : new BASE64Decoder().decodeBuffer(base64Code); + } + + + /** + * AES加密 + * @param content 待加密的内容 + * @param encryptKey 加密密钥 + * @return 加密后的byte[] + * @throws Exception + */ + public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + kgen.init(128); + Cipher cipher = Cipher.getInstance(ALGORITHMSTR); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES")); + + return cipher.doFinal(content.getBytes("utf-8")); + } + + + /** + * AES加密为base 64 code + * @param content 待加密的内容 + * @param encryptKey 加密密钥 + * @return 加密后的base 64 code + * @throws Exception + */ + public static String aesEncrypt(String content, String encryptKey) throws Exception { + return base64Encode(aesEncryptToBytes(content, encryptKey)); + } + + /** + * AES解密 + * @param encryptBytes 待解密的byte[] + * @param decryptKey 解密密钥 + * @return 解密后的String + * @throws Exception + */ + public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + kgen.init(128); + + Cipher cipher = Cipher.getInstance(ALGORITHMSTR); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES")); + byte[] decryptBytes = cipher.doFinal(encryptBytes); + return new String(decryptBytes); + } + + + /** + * 将base 64 code AES解密 + * @param encryptStr 待解密的base 64 code + * @param decryptKey 解密密钥 + * @return 解密后的string + * @throws Exception + */ + public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception { + return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey); + } + + /** + * 测试 + */ + public static void main(String[] args) throws Exception { + String content = "123"; + System.out.println("加密前:" + content); + System.out.println("加密密钥和解密密钥:" + KEY); + String encrypt = aesEncrypt(content, KEY); + System.out.println("加密后:" + encrypt); + String decrypt = aesDecrypt(encrypt, KEY); + System.out.println("解密后:" + decrypt); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/Base64Utils.java b/review_repo/src/main/java/com/zcloud/common/utils/Base64Utils.java new file mode 100644 index 0000000..3afe33f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/Base64Utils.java @@ -0,0 +1,142 @@ +package com.zcloud.common.utils; + +import org.apache.shiro.codec.Base64; + +import java.io.*; + +/** + *

+ * BASE64编码解码工具包 + *

+ */ +public class Base64Utils { + + /** */ + /** + * 文件读取缓冲区大小 + */ + private static final int CACHE_SIZE = 1024; + + /** */ + /** + *

+ * BASE64字符串解码为二进制数据 + *

+ * + * @param base64 + * @return + * @throws Exception + */ + public static byte[] decode(String base64) throws Exception { + return Base64.decode(base64.getBytes()); + } + + /** */ + /** + *

+ * 二进制数据编码为BASE64字符串 + *

+ * + * @param bytes + * @return + * @throws Exception + */ + public static String encode(byte[] bytes) throws Exception { + return new String(Base64.encode(bytes)); + } + + /** */ + /** + *

+ * 将文件编码为BASE64字符串 + *

+ *

+ * 大文件慎用,可能会导致内存溢出 + *

+ * + * @param filePath + * 文件绝对路径 + * @return + * @throws Exception + */ + public static String encodeFile(String filePath) throws Exception { + byte[] bytes = fileToByte(filePath); + return encode(bytes); + } + + /** */ + /** + *

+ * BASE64字符串转回文件 + *

+ * + * @param filePath + * 文件绝对路径 + * @param base64 + * 编码字符串 + * @throws Exception + */ + public static void decodeToFile(String filePath, String base64) throws Exception { + byte[] bytes = decode(base64); + byteArrayToFile(bytes, filePath); + } + + /** */ + /** + *

+ * 文件转换为二进制数组 + *

+ * + * @param filePath + * 文件路径 + * @return + * @throws Exception + */ + public static byte[] fileToByte(String filePath) throws Exception { + byte[] data = new byte[0]; + File file = new File(filePath); + if (file.exists()) { + FileInputStream in = new FileInputStream(file); + ByteArrayOutputStream out = new ByteArrayOutputStream(2048); + byte[] cache = new byte[CACHE_SIZE]; + int nRead = 0; + while ((nRead = in.read(cache)) != -1) { + out.write(cache, 0, nRead); + out.flush(); + } + out.close(); + in.close(); + data = out.toByteArray(); + } + return data; + } + + /** */ + /** + *

+ * 二进制数据写文件 + *

+ * + * @param bytes + * 二进制数据 + * @param filePath + * 文件生成目录 + */ + public static void byteArrayToFile(byte[] bytes, String filePath) throws Exception { + InputStream in = new ByteArrayInputStream(bytes); + File destFile = new File(filePath); + if (!destFile.getParentFile().exists()) { + destFile.getParentFile().mkdirs(); + } + destFile.createNewFile(); + OutputStream out = new FileOutputStream(destFile); + byte[] cache = new byte[CACHE_SIZE]; + int nRead = 0; + while ((nRead = in.read(cache)) != -1) { + out.write(cache, 0, nRead); + out.flush(); + } + out.close(); + in.close(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/CamelCaseUtil.java b/review_repo/src/main/java/com/zcloud/common/utils/CamelCaseUtil.java new file mode 100644 index 0000000..c22f5cd --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/CamelCaseUtil.java @@ -0,0 +1,38 @@ +package com.zcloud.common.utils; + +import java.util.HashMap; +import java.util.Map; + +public class CamelCaseUtil { + + public static Map camelToUnderline(Map sourceMap) { + Map targetMap = new HashMap<>(); + for (Map.Entry entry : sourceMap.entrySet()) { + String key = entry.getKey(); + String newKey = camelToUnderline(key); + targetMap.put(newKey, entry.getValue()); + } + return targetMap; + } + + private static String camelToUnderline(String camelCase) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < camelCase.length(); i++) { + char c = camelCase.charAt(i); + if (Character.isUpperCase(c)) { + sb.append("_").append(Character.toLowerCase(c)); + } else { + sb.append(c); + } + } + return sb.toString(); + } + + public static void main(String[] args) { + Map sourceMap = new HashMap<>(); + sourceMap.put("helloWorld", "value1"); + sourceMap.put("exampleKey", "value2"); + Map targetMap = camelToUnderline(sourceMap); + System.out.println(targetMap); // 输出: {hello_world=value1, example_key=value2} + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/ConfigConstant.java b/review_repo/src/main/java/com/zcloud/common/utils/ConfigConstant.java new file mode 100644 index 0000000..acefe0f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/ConfigConstant.java @@ -0,0 +1,12 @@ +package com.zcloud.common.utils; + +/** + * 系统参数相关Key + * + */ +public class ConfigConstant { + /** + * 云存储配置KEY + */ + public final static String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY"; +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/Const.java b/review_repo/src/main/java/com/zcloud/common/utils/Const.java new file mode 100644 index 0000000..3993fe7 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/Const.java @@ -0,0 +1,72 @@ +package com.zcloud.common.utils; + +/** + * 说明:常量 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class Const { + + public static final String SESSION_USER = "SESSION_USER"; //session用的用户 + public static final String SESSION_USERROL = "SESSION_USERROL"; //用户对象(包含角色信息) + public static final String SESSION_ROLE_RIGHTS = "SESSION_ROLE_RIGHTS"; //角色菜单权限 + public static final String SHIROSET = "SHIROSET"; //菜单权限标识 + public static final String SESSION_USERNAME = "USERNAME"; //用户名 + public static final String SESSION_U_NAME = "SESSION_U_NAME"; //用户姓名 + public static final String SESSION_ROLE = "SESSION_ROLE"; //主职角色信息 + public static final String SESSION_RNUMBERS = "RNUMBERS"; //角色编码数组 + public static final String SESSION_ALLMENU = "SESSION_ALLMENU"; //全部菜单 + public static final String SKIN = "SKIN"; //用户皮肤 + + public static final String SYSSET = "config/sysSet.ini"; //系统设置配置文件路径 + public static final String SYSNAME = "sysName"; //系统名称 + public static final String SHOWCOUNT = "showCount"; //每页条数 + + public static final String FILEPATHFILE = "/uploadFiles/file/"; //文件上传路径 + public static final String BIFILEPATHFILE = "/uploadFiles/Bfile/"; //文件上传路径 + public static final String FILEPATHIMG = "/uploadFiles/imgs/"; //图片上传路径 + public static final String FILEPATHIMGSPECIAL = "/uploadFiles/imgs/special/"; //图片上传路径(特种装备) + public static final String FILEPATHDZJM = "/uploadFiles/dzjm/"; //图片上传路径 + public static final String FILEPATHYHTP = "/uploadFiles/yhtp/"; //图片上传路径 + public static final String FILEPATHFXSST = "/uploadFiles/fxsst/"; //图片上传路径 风险四色图 + + public static final String FILEACTIVITI = "/uploadFiles/activitiFile/"; //工作流生成XML和PNG目录 + + public static final String DEPARTMENT_IDS = "DEPARTMENT_IDS"; //当前用户拥有的最高部门权限集合 + public static final String DEPARTMENT_ID = "DEPARTMENT_ID"; //当前用户拥有的最高部门权限 + public static final String CORPINFO_ID = "CORPINFO_ID"; //当前用户所属企业 + public static final String POST_ID = "POST_ID"; //当前用户所属企业 + public static final String PRECINCT_ID = "PRECINCT_ID"; //当前用户拥有的最高部门权限 + public static final String USER_ID = "USER_ID"; //当前用户userid + public static final String IS_MAIN = "IS_MAIN"; //是否主账号 + public static final String ISSUPERVISE = "ISSUPERVISE"; //是否监管部门 + + + public static final String FILEURL = "/mnt/qyag/file/"; //文件服务器地址 + public static final String HTTPFILEURL = "https://qyag.zcloudchina.com/file/"; //文件服务器地址 + + + public final static String APPID = "wx9199de454d31b016"; + public final static String SECRET = "183cdcac380e1f98f00c793491e27d88"; + public static final String XCX_MCH_ID = "1607757714"; + public static final String XCX_KEY = "zhuoyunkeji88888zhuoyunkeji88888"; + + public final static String OA_APPID = "wx69f7e25b3760001c";//公众号 + public final static String OA_SECRET = "087fe91f660300df63d0ef16fd162124";//公众号 + public static final String CORP_TRAINTYPE = "CORP_TRAINTYPE"; //当前用户所属企业的培训行业类型 + + + public static final String ALI_ACCESSKEY = "LTAI5tK134ZzXPEwykAdpVn2"; // 阿里云视频点播ak + public static final String ALI_ACCESSKEY_SECRET = "XCEMY8FG52cXImFMeIiH4tDJ9BIN3N"; //阿里云视频点播sk + //public static final String ALI_TEMPLATEGROUPID = "8666384eef7d52b290ba661d5e2684ab"; //阿里云视频转码模板id + public static final String ALI_TEMPLATEGROUPID = "eda7780b4706ec92ea47a79b6e6bcad1"; // 阿里云视频转码模板id + public static final String ALIYUN_REGIONID = "cn-beijing"; // 点播服务接入地域 + public static final String ENDPOINT = "vod.cn-beijing.aliyuncs.com";// 访问的域名 + + // 试题导入模板地址 + public static final String QUESTION_EXCEL_URL = "https://file.zcloudchina.com/busTripFile/template/questionExcelTemplate.xls"; + // 平台课件默认封面地址 + public static final String COURSEWARE_URL = "https://file.zcloudchina.com/knowledgeFile/template/courseware.png"; + + public static final String FILE_URL = "http://60.2.209.238:8991/file/"; +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/Constant.java b/review_repo/src/main/java/com/zcloud/common/utils/Constant.java new file mode 100644 index 0000000..1239e6e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/Constant.java @@ -0,0 +1,138 @@ +package com.zcloud.common.utils; + +import com.zcloud.common.validator.group.AliyunGroup; +import com.zcloud.common.validator.group.QcloudGroup; +import com.zcloud.common.validator.group.QiniuGroup; + +import java.util.Optional; +import java.util.stream.Stream; + +/** + * 常量 + */ +public class Constant { + /** + * 当前页码 + */ + public static final String PAGE = "curPage"; + /** + * 每页显示记录数 + */ + public static final String LIMIT = "limit"; + /** + * 排序字段 + */ + public static final String ORDER_FIELD = "sidx"; + /** + * 排序方式 + */ + public static final String ORDER = "order"; + /** + * 升序 + */ + public static final String ASC = "asc"; + + /** + * 菜单类型 + * + * @author chenshun + * @email sunlightcs@gmail.com + * @date 2016年11月15日 下午1:24:29 + */ + public enum MenuType { + /** + * 目录 + */ + CATALOG(0), + /** + * 菜单 + */ + MENU(1), + /** + * 按钮 + */ + BUTTON(2); + + private int value; + + MenuType(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 定时任务状态 + * + * @author chenshun + * @email sunlightcs@gmail.com + * @date 2016年12月3日 上午12:07:22 + */ + public enum ScheduleStatus { + /** + * 正常 + */ + NORMAL(0), + /** + * 暂停 + */ + PAUSE(1); + + private int value; + + ScheduleStatus(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 云服务商 + */ + public enum CloudService { + /** + * 七牛云 + */ + QINIU(1, QiniuGroup.class), + /** + * 阿里云 + */ + ALIYUN(2, AliyunGroup.class), + /** + * 腾讯云 + */ + QCLOUD(3, QcloudGroup.class); + + private int value; + + private Class validatorGroupClass; + + CloudService(int value, Class validatorGroupClass) { + this.value = value; + this.validatorGroupClass = validatorGroupClass; + } + + public int getValue() { + return value; + } + + public Class getValidatorGroupClass() { + return this.validatorGroupClass; + } + + public static CloudService getByValue(Integer value) { + Optional first = Stream.of(CloudService.values()).filter(cs -> value.equals(cs.value)).findFirst(); + if (!first.isPresent()) { + throw new IllegalArgumentException("非法的枚举值:" + value); + } + return first.get(); + } + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/DateUtil.java b/review_repo/src/main/java/com/zcloud/common/utils/DateUtil.java new file mode 100644 index 0000000..039c5c8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/DateUtil.java @@ -0,0 +1,444 @@ +package com.zcloud.common.utils; + +import org.apache.commons.lang.StringUtils; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.Calendar; +import java.util.Date; + +/** + * 说明:日期处理 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class DateUtil { + + private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy"); + private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd"); + private final static SimpleDateFormat sdfYearMonth = new SimpleDateFormat("yyyy-MM"); + private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd"); + private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss"); + + /** + * 获取YYYY格式 + * + * @return + */ + public static String getSdfTimes() { + return sdfTimes.format(new Date()); + } + + /** + * 获取YYYY格式 + * + * @return + */ + public static String getYear() { + return sdfYear.format(new Date()); + } + + public static String getYear(Date date) { + return sdfYear.format(date); + } + + /** + * 获取YYYY-MM-DD格式 + * + * @return + */ + public static String getDay() { + return sdfDay.format(new Date()); + } + + /** + * 获取YYYY-MM格式 + * + * @return + */ + public static String getYearMonth(Date date) { + return sdfYearMonth.format(date); + } + + // 获取季度数字 + public static int getYearQuarter(Date date) { + return Integer.parseInt(sdfYearMonth.format(date).substring(5, 7)) / 3 + 1; + } + + //获取月份数字 + public static int getMonth(Date date) { + return Integer.parseInt(sdfDay.format(date).substring(5, 7)); + } + + /** + * 获取YYYYMMDD格式 + * + * @return + */ + public static String getDays() { + return sdfDays.format(new Date()); + } + + /** + * 获取YYYY-MM-DD HH:mm:ss格式 + * + * @return + */ + public static String getTime() { + return sdfTime.format(new Date()); + } + + /** + * @param s + * @param e + * @return boolean + * @throws + * @Title: compareDate + * @Description: TODO(日期比较 , 如果s > = e 返回true 否则返回false) + * @author fh + */ + public static boolean compareDate(String s, String e) { + if (fomatDate(s) == null || fomatDate(e) == null) { + return false; + } + return fomatDate(s).getTime() >= fomatDate(e).getTime(); + } + + /** + * 格式化日期 + * + * @return + */ + public static Date fomatDate(String date) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + return fmt.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + /** + * 校验日期是否合法 + * + * @return + */ + public static boolean isValidDate(String s) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + fmt.parse(s); + return true; + } catch (Exception e) { + return false; // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 + } + } + + /** + * @param startTime + * @param endTime + * @return + */ + public static int getDiffYear(String startTime, String endTime) { + DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); + try { + int years = (int) (((fmt.parse(endTime).getTime() - fmt.parse(startTime).getTime()) / (1000 * 60 * 60 * 24)) / 365); + return years; + } catch (Exception e) { + return 0; // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对 + } + } + + /** + *
  • 功能描述:时间相减得到天数 + * + * @param beginDateStr + * @param endDateStr + * @return long + * @author Administrator + */ + public static long getDaySub(String beginDateStr, String endDateStr) { + long day = 0; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Date beginDate = null; + Date endDate = null; + try { + beginDate = format.parse(beginDateStr); + endDate = format.parse(endDateStr); + } catch (ParseException e) { + e.printStackTrace(); + } + day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000); + //System.out.println("相隔的天数="+day); + return day; + } + + /** + * 得到n天之后的日期 + * + * @param days + * @return + */ + public static String getAfterDayDate(String days) { + int daysInt = Integer.parseInt(days); + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateStr = sdfd.format(date); + return dateStr; + } + + /** + * 得到n天之后是周几 + * + * @param days + * @return + */ + public static String getAfterDayWeek(String days) { + int daysInt = Integer.parseInt(days); + Calendar canlendar = Calendar.getInstance(); // java.util包 + canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 + Date date = canlendar.getTime(); + SimpleDateFormat sdf = new SimpleDateFormat("E"); + String dateStr = sdf.format(date); + return dateStr; + } + + /** + * 按照yyyy-MM-dd HH:mm:ss的格式,日期转字符串 + * + * @param date + * @return yyyy-MM-dd HH:mm:ss + */ + public static String date2Str(Date date) { + return date2Str(date, "yyyy-MM-dd HH:mm:ss"); + } + + /** + * 按照yyyy-MM-dd HH:mm:ss的格式,字符串转日期 + * + * @param date + * @return + */ + public static Date str2Date(String date) { + if (StringUtils.isNotBlank(date)) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + return sdf.parse(date); + } catch (ParseException e) { + e.printStackTrace(); + } + return new Date(); + } else { + return null; + } + } + + /** + * 把时间根据时、分、秒转换为时间段 + * + * @param StrDate + */ + public static String getTimes(String StrDate) { + String resultTimes = ""; + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date now; + try { + now = new Date(); + Date date = df.parse(StrDate); + long times = now.getTime() - date.getTime(); + long day = times / (24 * 60 * 60 * 1000); + long hour = (times / (60 * 60 * 1000) - day * 24); + long min = ((times / (60 * 1000)) - day * 24 * 60 - hour * 60); + long sec = (times / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); + + StringBuffer sb = new StringBuffer(); + //sb.append("发表于:"); + if (hour > 0) { + sb.append(hour + "小时前"); + } else if (min > 0) { + sb.append(min + "分钟前"); + } else { + sb.append(sec + "秒前"); + } + resultTimes = sb.toString(); + } catch (ParseException e) { + e.printStackTrace(); + } + return resultTimes; + } + + /** + * 按照参数format的格式,日期转字符串 + * + * @param date + * @param format + * @return + */ + public static String date2Str(Date date, String format) { + if (date != null) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + } else { + return ""; + } + } + + /** + * 获取当年的第一天 + * + * @param year + * @return + * @author zhangyue + */ + public static String getCurrYearFirst() { + Calendar currCal = Calendar.getInstance(); + int currentYear = currCal.get(Calendar.YEAR); + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(Calendar.YEAR, currentYear); + Date currYearFirst = calendar.getTime(); + return sdfDay.format(currYearFirst); + } + + /** + * 获取当年的最后一天 + * + * @param year + * @return + * @author zhangyue + */ + public static String getCurrYearLast() { + Calendar currCal = Calendar.getInstance(); + int currentYear = currCal.get(Calendar.YEAR); + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(Calendar.YEAR, currentYear); + calendar.roll(Calendar.DAY_OF_YEAR, -1); + Date currYearLast = calendar.getTime(); + return sdfDay.format(currYearLast); + } + + + /** + * 获取当前季度第一天 + * + * @return + * @author zhangyue + */ + public static String quarterStart() { + Date dBegin = new Date(); + Calendar calBegin = Calendar.getInstance(); + calBegin.setTime(dBegin); + int remainder = calBegin.get(Calendar.MONTH) % 3; + int month = remainder != 0 ? calBegin.get(Calendar.MONTH) - remainder : calBegin.get(Calendar.MONTH); + + calBegin.set(Calendar.MONTH, month); + calBegin.set(Calendar.DAY_OF_MONTH, calBegin.getActualMinimum(Calendar.DAY_OF_MONTH)); + + calBegin.setTime(calBegin.getTime()); + return sdfDay.format(calBegin.getTime()); + } + + /** + * 获取当前季度最后一天 + * + * @return + * @author zhangyue + */ + public static String quarterEnd() { + Date dEnd = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(dEnd); + int remainder = (calendar.get(Calendar.MONTH) + 1) % 3; + int month = remainder != 0 ? calendar.get(Calendar.MONTH) + (3 - remainder) : calendar.get(Calendar.MONTH); + calendar.set(Calendar.MONTH, month); + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + calendar.setTime(calendar.getTime()); + return sdfDay.format(calendar.getTime()); + } + + /** + * 获取本月第一天日期 + * + * @return + */ + public static String getMonthFirstDay() { + Calendar thisMonthFirstDateCal = Calendar.getInstance(); + thisMonthFirstDateCal.set(Calendar.DAY_OF_MONTH, 1); + String thisMonthFirstTime = sdfDay.format(thisMonthFirstDateCal.getTime()); + return thisMonthFirstTime; + } + + /** + * 获取本月最后一天日期 + * + * @return + */ + public static String getMonthEndDay() { + Calendar thisMonthEndDateCal = Calendar.getInstance(); + thisMonthEndDateCal.set(Calendar.DAY_OF_MONTH, thisMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH)); + String thisMonthEndTime = sdfDay.format(thisMonthEndDateCal.getTime()); + return thisMonthEndTime; + } + + /** + * 判断两个日期字符串是否相差半年或半年的倍数。 + * + * @param dateStr1 第一个日期字符串 + * @param dateStr2 第二个日期字符串 + * @param formatter 日期格式 + * @return 如果两个日期相差半年或半年的倍数,返回true,否则返回false。 + */ + public static boolean isHalfYearApart(String dateStr1, String dateStr2, DateTimeFormatter formatter) { + LocalDate date1 = LocalDate.parse(dateStr1, formatter); + LocalDate date2 = LocalDate.parse(dateStr2, formatter); + + long monthsBetween = ChronoUnit.MONTHS.between(date1, date2); + return monthsBetween % 6 == 0; + } + + /** + * 给定一个日期,增加半年。 + * + * @param dateStr 需要增加半年的日期 + * @param formatter 日期格式 + * @return 增加半年后的日期 + */ + public static String addHalfYear(String dateStr, DateTimeFormatter formatter) { + LocalDate date = LocalDate.parse(dateStr, formatter); + LocalDate newDate = date.plus(Period.ofMonths(6)); + return newDate.format(formatter); + } + + /** + * 给定一个日期,减n个月。 + * + * @param date 需要计算的日期 + * @param n 月数 + * @return 增加半年后的日期 + */ + public static Date getLastMonth(Date date,int n) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, -n); + return calendar.getTime(); + } + + public static void main(String[] args) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String dateStr1 = "2023-09-01"; + String dateStr2 = "2024-03-01"; + Date newDateStr = getLastMonth(fomatDate(dateStr1), 12); + System.out.println(newDateStr); + + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/DateUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/DateUtils.java new file mode 100644 index 0000000..15921b3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/DateUtils.java @@ -0,0 +1,160 @@ + + +package com.zcloud.common.utils; + +import org.apache.commons.lang.StringUtils; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 日期处理 + * + * + */ +public class DateUtils { + /** 时间格式(yyyy-MM-dd) */ + public final static String DATE_PATTERN = "yyyy-MM-dd"; + /** 时间格式(yyyy-MM-dd HH:mm:ss) */ + public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; + + /** + * 日期格式化 日期格式为:yyyy-MM-dd + * @param date 日期 + * @return 返回yyyy-MM-dd格式日期 + */ + public static String format(Date date) { + return format(date, DATE_PATTERN); + } + + /** + * 日期格式化 日期格式为:yyyy-MM-dd + * @param date 日期 + * @param pattern 格式,如:DateUtils.DATE_TIME_PATTERN + * @return 返回yyyy-MM-dd格式日期 + */ + public static String format(Date date, String pattern) { + if(date != null){ + SimpleDateFormat df = new SimpleDateFormat(pattern); + return df.format(date); + } + return null; + } + + /** + * 字符串转换成日期 + * @param strDate 日期字符串 + * @param pattern 日期的格式,如:DateUtils.DATE_TIME_PATTERN + */ + public static Date stringToDate(String strDate, String pattern) { + if (StringUtils.isBlank(strDate)){ + return null; + } + + DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern); + return fmt.parseLocalDateTime(strDate).toDate(); + } + + /** + * 根据周数,获取开始日期、结束日期 + * @param week 周期 0本周,-1上周,-2上上周,1下周,2下下周 + * @return 返回date[0]开始日期、date[1]结束日期 + */ + public static Date[] getWeekStartAndEnd(int week) { + DateTime dateTime = new DateTime(); + LocalDate date = new LocalDate(dateTime.plusWeeks(week)); + + date = date.dayOfWeek().withMinimumValue(); + Date beginDate = date.toDate(); + Date endDate = date.plusDays(6).toDate(); + return new Date[]{beginDate, endDate}; + } + + /** + * 对日期的【秒】进行加/减 + * + * @param date 日期 + * @param seconds 秒数,负数为减 + * @return 加/减几秒后的日期 + */ + public static Date addDateSeconds(Date date, int seconds) { + DateTime dateTime = new DateTime(date); + return dateTime.plusSeconds(seconds).toDate(); + } + + /** + * 对日期的【分钟】进行加/减 + * + * @param date 日期 + * @param minutes 分钟数,负数为减 + * @return 加/减几分钟后的日期 + */ + public static Date addDateMinutes(Date date, int minutes) { + DateTime dateTime = new DateTime(date); + return dateTime.plusMinutes(minutes).toDate(); + } + + /** + * 对日期的【小时】进行加/减 + * + * @param date 日期 + * @param hours 小时数,负数为减 + * @return 加/减几小时后的日期 + */ + public static Date addDateHours(Date date, int hours) { + DateTime dateTime = new DateTime(date); + return dateTime.plusHours(hours).toDate(); + } + + /** + * 对日期的【天】进行加/减 + * + * @param date 日期 + * @param days 天数,负数为减 + * @return 加/减几天后的日期 + */ + public static Date addDateDays(Date date, int days) { + DateTime dateTime = new DateTime(date); + return dateTime.plusDays(days).toDate(); + } + + /** + * 对日期的【周】进行加/减 + * + * @param date 日期 + * @param weeks 周数,负数为减 + * @return 加/减几周后的日期 + */ + public static Date addDateWeeks(Date date, int weeks) { + DateTime dateTime = new DateTime(date); + return dateTime.plusWeeks(weeks).toDate(); + } + + /** + * 对日期的【月】进行加/减 + * + * @param date 日期 + * @param months 月数,负数为减 + * @return 加/减几月后的日期 + */ + public static Date addDateMonths(Date date, int months) { + DateTime dateTime = new DateTime(date); + return dateTime.plusMonths(months).toDate(); + } + + /** + * 对日期的【年】进行加/减 + * + * @param date 日期 + * @param years 年数,负数为减 + * @return 加/减几年后的日期 + */ + public static Date addDateYears(Date date, int years) { + DateTime dateTime = new DateTime(date); + return dateTime.plusYears(years).toDate(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/FileUpload.java b/review_repo/src/main/java/com/zcloud/common/utils/FileUpload.java new file mode 100644 index 0000000..bced528 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/FileUpload.java @@ -0,0 +1,101 @@ +package com.zcloud.common.utils; + +import org.apache.commons.io.FileUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.*; +import java.net.MalformedURLException; +import java.net.URL; + +/** + * 说明:上传文件 + + + */ +public class FileUpload { + + /**上传文件 + * @param file //文件对象 + * @param filePath //上传路径 + * @param fileName //文件名 + * @return 文件名 + */ + public static String fileUp(MultipartFile file, String filePath, String fileName){ + String extName = ""; // 扩展名格式: + try { + if (file.getOriginalFilename().lastIndexOf(".") >= 0){ + extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + } + copyFile(file.getInputStream(), filePath, fileName+extName).replaceAll("-", ""); + } catch (IOException e) { + System.out.println(e); + } + return fileName+extName; + } + + /** + * 写文件到当前目录的upload目录中 + * @param in + * @throws IOException + */ + public static String copyFile(InputStream in, String dir, String realName) + throws IOException { + File file = mkdirsmy(dir,realName); + FileUtils.copyInputStreamToFile(in, file); + in.close(); + return realName; + } + + + /**判断路径是否存在,否:创建此路径 + * @param dir 文件路径 + * @param realName 文件名 + * @throws IOException + */ + public static File mkdirsmy(String dir, String realName) throws IOException{ + File file = new File(dir, realName); + if (!file.exists()) { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + file.createNewFile(); + } + return file; + } + + + /**下载网络图片上传到服务器上 + * @param httpUrl 图片网络地址 + * @param filePath 图片保存路径 + * @param myFileName 图片文件名(null时用网络图片原名) + * @return 返回图片名称 + */ + public static String getHtmlPicture(String httpUrl, String filePath , String myFileName) { + + URL url; //定义URL对象url + BufferedInputStream in; //定义输入字节缓冲流对象in + FileOutputStream file; //定义文件输出流对象file + try { + String fileName = null == myFileName?httpUrl.substring(httpUrl.lastIndexOf("/")).replace("/", ""):myFileName; //图片文件名(null时用网络图片原名) + url = new URL(httpUrl); //初始化url对象 + in = new BufferedInputStream(url.openStream()); //初始化in对象,也就是获得url字节流 + //file = new FileOutputStream(new File(filePath +"\\"+ fileName)); + file = new FileOutputStream(mkdirsmy(filePath,fileName)); + int t; + while ((t = in.read()) != -1) { + file.write(t); + } + file.close(); + in.close(); + return fileName; + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/FileUploadUtil.java b/review_repo/src/main/java/com/zcloud/common/utils/FileUploadUtil.java new file mode 100644 index 0000000..537447b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/FileUploadUtil.java @@ -0,0 +1,97 @@ +package com.zcloud.common.utils; + +import com.aliyun.oss.ClientException; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + + +@Component +public class FileUploadUtil { + + private static String endpoint = "https://oss-cn-zhangjiakou.aliyuncs.com"; + // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。 + private static String accessKeyId = "LTAI5tK134ZzXPEwykAdpVn2"; + private static String accessKeySecret = "XCEMY8FG52cXImFMeIiH4tDJ9BIN3N"; + // 填写Bucket名称。 + private static String bucketName = "qyag"; + + public static void sshSftp(MultipartFile file, String fileName, String path){ + String objectName = "reviewReportFile" + path + "/" + fileName; + // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。 + // 创建OSSClient实例。 + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + + try { + + // 创建PutObject请求。 + ossClient.putObject(bucketName, objectName, file.getInputStream()); + + // 创建PutObjectRequest对象。 + // 如果需要上传时设置存储类型和访问权限,请参考以下示例代码。 + // ObjectMetadata metadata = new ObjectMetadata(); + // metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString()); + // metadata.setObjectAcl(CannedAccessControlList.Private); + // putObjectRequest.setMetadata(metadata); + + // 上传文件。 + } catch (OSSException oe) { + System.out.println("Caught an OSSException, which means your request made it to OSS, " + + "but was rejected with an error response for some reason."); + System.out.println("Error Message:" + oe.getErrorMessage()); + System.out.println("Error Code:" + oe.getErrorCode()); + System.out.println("Request ID:" + oe.getRequestId()); + System.out.println("Host ID:" + oe.getHostId()); + } catch (ClientException ce) { + System.out.println("Caught an ClientException, which means the client encountered " + + "a serious internal problem while trying to communicate with OSS, " + + "such as not being able to access the network."); + System.out.println("Error Message:" + ce.getMessage()); + } catch (IOException e) { + System.out.println("Error Message:" + e.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + /** + * 删除文件 + */ + public static void deleteFile(String directoryFile) { + + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + + try { + // 删除文件或目录。如果要删除目录,目录必须为空。 + ossClient.deleteObject(bucketName, "busTripFile" + directoryFile); + } catch (OSSException oe) { + System.out.println("Caught an OSSException, which means your request made it to OSS, " + + "but was rejected with an error response for some reason."); + System.out.println("Error Message:" + oe.getErrorMessage()); + System.out.println("Error Code:" + oe.getErrorCode()); + System.out.println("Request ID:" + oe.getRequestId()); + System.out.println("Host ID:" + oe.getHostId()); + } catch (ClientException ce) { + System.out.println("Caught an ClientException, which means the client encountered " + + "a serious internal problem while trying to communicate with OSS, " + + "such as not being able to access the network."); + System.out.println("Error Message:" + ce.getMessage()); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + + } +} + + diff --git a/review_repo/src/main/java/com/zcloud/common/utils/HttpContextUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/HttpContextUtils.java new file mode 100644 index 0000000..a5de547 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/HttpContextUtils.java @@ -0,0 +1,24 @@ +package com.zcloud.common.utils; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +public class HttpContextUtils { + + public static HttpServletRequest getHttpServletRequest() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + } + + public static String getDomain(){ + HttpServletRequest request = getHttpServletRequest(); + StringBuffer url = request.getRequestURL(); + return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString(); + } + + public static String getOrigin(){ + HttpServletRequest request = getHttpServletRequest(); + return request.getHeader("Origin"); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/HttpRequestUtil.java b/review_repo/src/main/java/com/zcloud/common/utils/HttpRequestUtil.java new file mode 100644 index 0000000..7140da1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/HttpRequestUtil.java @@ -0,0 +1,223 @@ +package com.zcloud.common.utils; + +import com.alibaba.fastjson.JSONObject; +import org.springframework.lang.Nullable; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; + +/** + * description: http请求工具类 + * + * @date 2022-07-01 + */ +public class HttpRequestUtil { + + public static String sendRequest(String urlParam) throws Exception { + InputStream inputStream = null; + BufferedReader buffer = null; + try { + URL url = new URL(urlParam); + URLConnection con = url.openConnection(); + //设置请求需要返回的数据类型和字符集类型 + con.setRequestProperty("Content-Type", "application/json;charset=GBK"); + //允许写出 + con.setDoOutput(true); + //允许读入 + con.setDoInput(true); + //不使用缓存 + con.setUseCaches(false); + //得到响应流 + inputStream = con.getInputStream(); + //将响应流转换成字符串 + StringBuffer resultBuffer = new StringBuffer(); + String line; + buffer = new BufferedReader(new InputStreamReader(inputStream, "GBK")); + while ((line = buffer.readLine()) != null) { + resultBuffer.append(line); + } + return resultBuffer.toString(); + } catch (Exception e) { + buffer.close(); + inputStream.close(); + e.printStackTrace(); + } + + return ""; + } + + public static String getRestInformation(HttpServletRequest request) throws Exception { + return getRestInformation(request,String.class); + } + + public static T getRestInformation(HttpServletRequest request, Class clazz) throws Exception { + BufferedReader reader = null; + try { + + StringBuffer data = new StringBuffer(); + String line = null; + reader = request.getReader(); + while (null != (line = reader.readLine())) data.append(line); + reader.close(); + T result = JSONObject.parseObject(data.toString(), clazz); + return result; + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("解析请求报文出错"); + } finally { + reader.close(); + } + } + + /** + * Http get请求 + * @param httpUrl 连接 + * @return 响应数据 + */ + public static String doGet(String httpUrl) throws Exception{ + //链接 + HttpURLConnection connection = null; + InputStream is = null; + BufferedReader br = null; + StringBuffer result = new StringBuffer(); + try { + //创建连接 + URL url = new URL(httpUrl); + connection = (HttpURLConnection) url.openConnection(); + //设置请求方式 + connection.setRequestMethod("GET"); + //设置连接超时时间 + connection.setReadTimeout(15000); + //开始连接 + connection.connect(); + //获取响应数据 + if (connection.getResponseCode() == 200) { + //获取返回的数据 + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭远程连接 + connection.disconnect(); + } + return result.toString(); + } + + /** + * Http post请求 + * @param httpUrl 连接 + * @param param 参数 + * @return + */ + public static String doPost(String httpUrl, @Nullable String param) { + StringBuffer result = new StringBuffer(); + //连接 + HttpURLConnection connection = null; + OutputStream os = null; + InputStream is = null; + BufferedReader br = null; + try { + //创建连接对象 + URL url = new URL(httpUrl); + //创建连接 + connection = (HttpURLConnection) url.openConnection(); + //设置请求方法 + connection.setRequestMethod("POST"); + //设置连接超时时间 + connection.setConnectTimeout(15000); + //设置读取超时时间 + connection.setReadTimeout(15000); + //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个 + //设置是否可读取 + connection.setDoOutput(true); + connection.setDoInput(true); + //设置通用的请求属性 +// connection.setRequestProperty("accept", "*/*"); +// connection.setRequestProperty("connection", "Keep-Alive"); +// connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); + System.out.println(param); + //拼装参数 + if (null != param && !param.equals("")) { + //设置参数 + os = connection.getOutputStream(); + //拼装参数 + os.write(param.getBytes()); + } + //设置权限 + //设置请求头等 + //开启连接 + //connection.connect(); + //读取响应 + if (connection.getResponseCode() == 200) { + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + result.append("\r\n"); + } + } + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + //关闭连接 + if(br!=null){ + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if(os!=null){ + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if(is!=null){ + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭连接 + connection.disconnect(); + } + return result.toString(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/IPUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/IPUtils.java new file mode 100644 index 0000000..cbc0098 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/IPUtils.java @@ -0,0 +1,58 @@ + + +package com.zcloud.common.utils; + +import com.alibaba.druid.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.http.HttpServletRequest; + +/** + * IP地址 + * + * + */ +public class IPUtils { + private static Logger logger = LoggerFactory.getLogger(IPUtils.class); + + /** + * 获取IP地址 + * + * 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址 + * 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址 + */ + public static String getIpAddr(HttpServletRequest request) { + String ip = null; + try { + ip = request.getHeader("x-forwarded-for"); + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + } catch (Exception e) { + logger.error("IPUtils ERROR ", e); + } + +// //使用代理,则获取第一个IP地址 +// if(StringUtils.isEmpty(ip) && ip.length() > 15) { +// if(ip.indexOf(",") > 0) { +// ip = ip.substring(0, ip.indexOf(",")); +// } +// } + + return ip; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/MD5.java b/review_repo/src/main/java/com/zcloud/common/utils/MD5.java new file mode 100644 index 0000000..e028de7 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/MD5.java @@ -0,0 +1,40 @@ +package com.zcloud.common.utils; + +import java.security.MessageDigest; + +/** + * 说明:MD5处理 + + + */ +public class MD5 { + + public static String md5(String str) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(str.getBytes()); + byte b[] = md.digest(); + + int i; + + StringBuffer buf = new StringBuffer(""); + for (int offset = 0; offset < b.length; offset++) { + i = b[offset]; + if (i < 0) + i += 256; + if (i < 16) + buf.append("0"); + buf.append(Integer.toHexString(i)); + } + str = buf.toString(); + } catch (Exception e) { + e.printStackTrace(); + + } + return str; + } + public static void main(String[] args) { + System.out.println(md5("313596790@qq.com"+"123456")); + System.out.println(md5("mj1")); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/MP4Util.java b/review_repo/src/main/java/com/zcloud/common/utils/MP4Util.java new file mode 100644 index 0000000..a4bd8ae --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/MP4Util.java @@ -0,0 +1,46 @@ +package com.zcloud.common.utils; + +import ws.schild.jave.MultimediaInfo; +import ws.schild.jave.MultimediaObject; +import ws.schild.jave.VideoInfo; + +import java.io.File; +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * @author fangjiakai + * @date 2023/10/20 10:10 + */ +public class MP4Util { + public static String getMP4Time(File video) { + // 视频时长 + String time = "0"; + try { + MultimediaObject media = new MultimediaObject(video); + MultimediaInfo info = media.getInfo(); + // 时长,毫秒级 + long duration = info.getDuration(); + // 毫秒级时长转化为秒 + BigDecimal bigDecimal1 = new BigDecimal(duration); + BigDecimal bigDecimal2 = new BigDecimal(1000); + // 四舍五入,只保留整数 + time = bigDecimal1.divide(bigDecimal2, 0, RoundingMode.HALF_UP).toString(); +// // 获取媒体视频对象 +// VideoInfo video = info.getVideo(); +// // 码率 +// int bitRate = video.getBitRate(); +// // 帧率 +// float frameRate = video.getFrameRate(); +// // 分辨率-高 +// int height = video.getSize().getHeight(); +// // 分辨率-宽 +// int width = video.getSize().getWidth(); +// // 视频解码器名称 +// String decoder = video.getDecoder(); + } catch (Exception e) { + e.getMessage(); + } + return time; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/MapUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/MapUtils.java new file mode 100644 index 0000000..4efcfb9 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/MapUtils.java @@ -0,0 +1,20 @@ + + +package com.zcloud.common.utils; + +import java.util.HashMap; + + +/** + * Map工具类 + * + * + */ +public class MapUtils extends HashMap { + + @Override + public MapUtils put(String key, Object value) { + super.put(key, value); + return this; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/ObjectExcelRead.java b/review_repo/src/main/java/com/zcloud/common/utils/ObjectExcelRead.java new file mode 100644 index 0000000..7798b42 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/ObjectExcelRead.java @@ -0,0 +1,63 @@ +package com.zcloud.common.utils; + +import com.zcloud.modules.sys.entity.PageData; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + + +/** + * 说明:从EXCEL导入到系统 + + + */ +public class ObjectExcelRead { + + /** + * @param filepath //文件路径 + * @param filename //文件名 + * @param startrow //开始行号 + * @param startcol //开始列号 + * @param sheetnum //sheet + * @return list + */ + public static List readExcel(String filepath, String filename, int startrow, int startcol, int sheetnum) { + List varList = new ArrayList(); + + try { + File target = new File(filepath, filename); + FileInputStream fi = new FileInputStream(target); + HSSFWorkbook wb = new HSSFWorkbook(fi); + HSSFSheet sheet = wb.getSheetAt(sheetnum); //sheet 从0开始 + int rowNum = sheet.getLastRowNum() + 1; //取得最后一行的行号 + + for (int i = startrow; i < rowNum; i++) { //行循环开始 + + PageData varpd = new PageData(); + HSSFRow row = sheet.getRow(i); //行 + int cellNum = row.getLastCellNum(); //每行的最后一个单元格位置 + + for (int j = startcol; j < cellNum; j++) { //列循环开始 + + HSSFCell cell = row.getCell(Short.parseShort(j + "")); + if(cell != null){ + varpd.put("var"+j, cell.toString()); + } + + } + varList.add(varpd); + } + + } catch (Exception e) { + System.out.println(e); + } + + return varList; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/PageUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/PageUtils.java new file mode 100644 index 0000000..9365d84 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/PageUtils.java @@ -0,0 +1,104 @@ + + +package com.zcloud.common.utils; + +import com.baomidou.mybatisplus.core.metadata.IPage; + +import java.io.Serializable; +import java.util.List; + +/** + * 分页工具类 + * + * + */ +public class PageUtils implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 总记录数 + */ + private int totalCount; + /** + * 每页记录数 + */ + private int pageSize; + /** + * 总页数 + */ + private int totalPage; + /** + * 当前页数 + */ + private int currPage; + /** + * 列表数据 + */ + private List list; + + /** + * 分页 + * @param list 列表数据 + * @param totalCount 总记录数 + * @param pageSize 每页记录数 + * @param currPage 当前页数 + */ + public PageUtils(List list, int totalCount, int pageSize, int currPage) { + this.list = list; + this.totalCount = totalCount; + this.pageSize = pageSize; + this.currPage = currPage; + this.totalPage = (int)Math.ceil((double)totalCount/pageSize); + } + + /** + * 分页 + */ + public PageUtils(IPage page) { + this.list = page.getRecords(); + this.totalCount = (int)page.getTotal(); + this.pageSize = (int)page.getSize(); + this.currPage = (int)page.getCurrent(); + this.totalPage = (int)page.getPages(); + } + + public int getTotalCount() { + return totalCount; + } + + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + public int getCurrPage() { + return currPage; + } + + public void setCurrPage(int currPage) { + this.currPage = currPage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/PathUtil.java b/review_repo/src/main/java/com/zcloud/common/utils/PathUtil.java new file mode 100644 index 0000000..ecfbb26 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/PathUtil.java @@ -0,0 +1,38 @@ +package com.zcloud.common.utils; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; + +/** + * 说明:路径工具类 + + + */ +public class PathUtil { + + /**获取Projectpath + * @return + */ + public static String getProjectpath(){ + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getServletContext().getRealPath("/").replaceAll("%20", " ").replaceAll("file:/", "").trim(); + return path; + } + + /**获取Classpath + * @return + */ + public static String getClasspath(){ + String path = (String.valueOf(Thread.currentThread().getContextClassLoader().getResource(""))).replaceAll("file:/", "").replaceAll("%20", " ").trim(); + if(path.indexOf(":") != 1){ + path = File.separator + path; + + } + //path = "H:\\"; //当项目以jar、war包运行时,路径改成实际硬盘位置 + return path; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/Query.java b/review_repo/src/main/java/com/zcloud/common/utils/Query.java new file mode 100644 index 0000000..848c20f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/Query.java @@ -0,0 +1,69 @@ +package com.zcloud.common.utils; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zcloud.common.xss.SQLFilter; +import org.apache.commons.lang.StringUtils; + +import java.util.Map; + +/** + * 查询参数 + * + * + */ +public class Query { + + public IPage getPage(Map params) { + return this.getPage(params, null, false); + } + + public IPage getPage(Map params, String defaultOrderField, boolean isAsc) { + //分页参数 + long curPage = 1; + long limit = 10; + + if(params.get(Constant.PAGE) != null){ + curPage = Long.parseLong(params.get(Constant.PAGE).toString()); + } + if(params.get(Constant.LIMIT) != null){ + limit = Long.parseLong(params.get(Constant.LIMIT).toString()); + } + + //分页对象 + Page page = new Page<>(curPage, limit); + + //分页参数 + params.put(Constant.PAGE, page); + + //排序字段 + //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) + String orderField = SQLFilter.sqlInject((String)params.get(Constant.ORDER_FIELD)); + String order = (String)params.get(Constant.ORDER); + + + //前端字段排序 + if(StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)){ + if(Constant.ASC.equalsIgnoreCase(order)) { + return page.addOrder(OrderItem.asc(orderField)); + }else { + return page.addOrder(OrderItem.desc(orderField)); + } + } + + //没有排序字段,则不排序 + if(StringUtils.isBlank(defaultOrderField)){ + return page; + } + + //默认排序 + if(isAsc) { + page.addOrder(OrderItem.asc(defaultOrderField)); + }else { + page.addOrder(OrderItem.desc(defaultOrderField)); + } + + return page; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/R.java b/review_repo/src/main/java/com/zcloud/common/utils/R.java new file mode 100644 index 0000000..f6414f3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/R.java @@ -0,0 +1,59 @@ + + +package com.zcloud.common.utils; + +import org.apache.http.HttpStatus; + +import java.util.HashMap; +import java.util.Map; + +/** + * 返回数据 + * + * + */ +public class R extends HashMap { + private static final long serialVersionUID = 1L; + + public R() { + put("code", 200); + put("result", "success"); + } + + public static R error() { + return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员"); + } + + public static R error(String msg) { + return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg); + } + + public static R error(int code, String msg) { + R r = new R(); + r.put("code", code); + r.put("result", "failed"); + r.put("msg", msg); + return r; + } + + public static R ok(String msg) { + R r = new R(); + r.put("msg", msg); + return r; + } + + public static R ok(Map map) { + R r = new R(); + r.putAll(map); + return r; + } + + public static R ok() { + return new R(); + } + + public R put(String key, Object value) { + super.put(key, value); + return this; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/RSAUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/RSAUtils.java new file mode 100644 index 0000000..df94265 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/RSAUtils.java @@ -0,0 +1,404 @@ +package com.zcloud.common.utils; + +import javax.crypto.Cipher; +import java.io.ByteArrayOutputStream; +import java.security.*; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; + +/** + * RSA公钥/私钥/签名工具包 + *

    + * 字符串格式的密钥在未在特殊说明情况下都为BASE64编码格式
    + * 由于非对称加密速度极其缓慢,一般文件不使用它来加密而是使用对称加密,
    + * 非对称加密算法可以用来对对称加密的密钥加密,这样保证密钥的安全也就保证了数据的安全 + *

    + * + */ +public class RSAUtils { + + /** */ + /** + * 加密算法RSA + */ + public static final String KEY_ALGORITHM = "RSA"; + + /** */ + /** + * 签名算法 + */ + public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; + + /** */ + /** + * 获取公钥的key + */ + private static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDUoHAavCikaZxjlDM6Km8cX+ye78F4oF39AcEfnE1p2Yn9pJ9WFxYZ4Vkh6F8SKMi7k4nYsKceqB1RwG996SvHQ5C3pM3nbXCP4K15ad6QhN4a7lzlbLhiJcyIKszvvK8ncUDw8mVQ0j/2mwxv05yH6LN9OKU6Hzm1ninpWeE+awIDAQAB\n"; + + /** */ + /** + * 获取私钥的key + */ + private static final String PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANSgcBq8KKRpnGOUMzoqbxxf7J7vwXigXf0BwR+cTWnZif2kn1YXFhnhWSHoXxIoyLuTidiwpx6oHVHAb33pK8dDkLekzedtcI/grXlp3pCE3hruXOVsuGIlzIgqzO+8rydxQPDyZVDSP/abDG/TnIfos304pTofObWeKelZ4T5rAgMBAAECgYEAt2Dvjn885h+Xm2JTlBTI40Xvw1uwFqLorK54qxSYx3OwySrTqOIcU5HA17ebVwQJq40hU9t3Jr+DGeDHx2X0NEJ0LXuDMzeWxUwUMbdxxM7OXS6Zuhy73C99DyAweLP9K1H2J/y1+eJ4Zx/0mTiAgCKJFNWAQBZwGl5Zu2zoHOECQQDw0UlrOUfloxK3hfVSWlfL7+onP+z/qa9bzemSg676sAJqA8d5ao8V532OBOtZxfPSlh4igC0lpY2vnCRHrwJZAkEA4ggpMS4o+rfFmNslNzI0m3VFDiLYmghYIqTLHtLYqAbY8QVfFd8bl920t5LQAlTsI3q9Spsu8y7AnAWmYydGYwJAN+tBMya/7TDqvbbbel4EGRUCuE59x/gtAhJUdHMjhI6uYNOz1BvMUffJDdtSkywGLBYztSsyUJWayvZk7khTMQJAALM7xW46LESjdQzAucILDaw4UYnkF94Mv9a41lia2TJkO6Ljn4K4aCkEpUjsIgW3UYjQy0ldxN0RNaqC0G3PtwJAFafiLzcls6qzyAlh5PqM5cJrs+Xa0rHR322/AlSyuxW6wRzUX/zSoorP34JCjRPT5DzUeHMVvr6S2BE8k/8XYg=="; + + /** */ + /** + * RSA最大加密明文大小 + */ + private static final int MAX_ENCRYPT_BLOCK = 117; + + /** */ + /** + * RSA最大解密密文大小 + */ + private static final int MAX_DECRYPT_BLOCK = 128; + + /** */ + /** + *

    + * 生成密钥对(公钥和私钥) + *

    + * + * @return + * @throws Exception + */ + public static Map genKeyPair() throws Exception { + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); + keyPairGen.initialize(1024); + KeyPair keyPair = keyPairGen.generateKeyPair(); + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); + RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); + Map keyMap = new HashMap(2); + keyMap.put(PUBLIC_KEY, publicKey); + keyMap.put(PRIVATE_KEY, privateKey); + return keyMap; + } + + /** */ + /** + *

    + * 用私钥对信息生成数字签名 + *

    + * + * @param data + * 已加密数据 + * @param privateKey + * 私钥(BASE64编码) + * + * @return + * @throws Exception + */ + public static String sign(byte[] data, String privateKey) throws Exception { + byte[] keyBytes = Base64Utils.decode(privateKey); + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + PrivateKey privateK = keyFactory.generatePrivate(pkcs8KeySpec); + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initSign(privateK); + signature.update(data); + return Base64Utils.encode(signature.sign()); + } + + /** */ + /** + *

    + * 校验数字签名 + *

    + * + * @param data + * 已加密数据 + * @param publicKey + * 公钥(BASE64编码) + * @param sign + * 数字签名 + * + * @return + * @throws Exception + * + */ + public static boolean verify(byte[] data, String publicKey, String sign) throws Exception { + byte[] keyBytes = Base64Utils.decode(publicKey); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + PublicKey publicK = keyFactory.generatePublic(keySpec); + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initVerify(publicK); + signature.update(data); + return signature.verify(Base64Utils.decode(sign)); + } + + /** */ + /** + *

    + * 私钥解密 + *

    + * + * @param encryptedData + * 已加密数据 + * @param privateKey + * 私钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey) throws Exception { + byte[] keyBytes = Base64Utils.decode(privateKey); + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateK = keyFactory.generatePrivate(pkcs8KeySpec); + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, privateK); + int inputLen = encryptedData.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段解密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_DECRYPT_BLOCK) { + cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); + } else { + cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_DECRYPT_BLOCK; + } + byte[] decryptedData = out.toByteArray(); + out.close(); + return decryptedData; + } + + /** */ + /** + *

    + * 公钥解密 + *

    + * + * @param encryptedData + * 已加密数据 + * @param publicKey + * 公钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey) throws Exception { + byte[] keyBytes = Base64Utils.decode(publicKey); + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicK = keyFactory.generatePublic(x509KeySpec); + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, publicK); + int inputLen = encryptedData.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段解密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_DECRYPT_BLOCK) { + cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); + } else { + cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_DECRYPT_BLOCK; + } + byte[] decryptedData = out.toByteArray(); + out.close(); + return decryptedData; + } + + /** */ + /** + *

    + * 公钥加密 + *

    + * + * @param data + * 源数据 + * @param publicKey + * 公钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception { + byte[] keyBytes = Base64Utils.decode(publicKey); + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicK = keyFactory.generatePublic(x509KeySpec); + // 对数据加密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, publicK); + int inputLen = data.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段加密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { + cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK); + } else { + cache = cipher.doFinal(data, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_ENCRYPT_BLOCK; + } + byte[] encryptedData = out.toByteArray(); + out.close(); + return encryptedData; + } + + /** */ + /** + *

    + * 私钥加密 + *

    + * + * @param data + * 源数据 + * @param privateKey + * 私钥(BASE64编码) + * @return + * @throws Exception + */ + public static byte[] encryptByPrivateKey(byte[] data, String privateKey) throws Exception { + byte[] keyBytes = Base64Utils.decode(privateKey); + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateK = keyFactory.generatePrivate(pkcs8KeySpec); + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, privateK); + int inputLen = data.length; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int offSet = 0; + byte[] cache; + int i = 0; + // 对数据分段加密 + while (inputLen - offSet > 0) { + if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { + cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK); + } else { + cache = cipher.doFinal(data, offSet, inputLen - offSet); + } + out.write(cache, 0, cache.length); + i++; + offSet = i * MAX_ENCRYPT_BLOCK; + } + byte[] encryptedData = out.toByteArray(); + out.close(); + return encryptedData; + } + + /** */ + /** + *

    + * 获取私钥 + *

    + * + * @param keyMap + * 密钥对 + * @return + * @throws Exception + */ + public static String getPrivateKey(Map keyMap) throws Exception { + Key key = (Key) keyMap.get(PRIVATE_KEY); + return Base64Utils.encode(key.getEncoded()); + } + + /** */ + /** + *

    + * 获取私钥 + *

    + * + * @param keyMap + * 密钥对 + * @return + * @throws Exception + */ + public static String getPrivateKey() { + return PRIVATE_KEY; + } + + /** */ + /** + *

    + * 获取公钥 + *

    + * + * @param keyMap + * 密钥对 + * @return + * @throws Exception + */ + public static String getPublicKey(Map keyMap) throws Exception { + Key key = (Key) keyMap.get(PUBLIC_KEY); + return Base64Utils.encode(key.getEncoded()); + } + + /** */ + /** + *

    + * 获取公钥 + *

    + * @return + * @throws Exception + */ + public static String getPublicKey() throws Exception { + return PUBLIC_KEY; + } + + /** + * java端公钥加密 + */ + public static String encryptedDataOnJava(String data, String PUBLICKEY) { + try { + data = Base64Utils.encode(encryptByPublicKey(data.getBytes(), PUBLICKEY)); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return data; + } + + /** + * java端私钥解密 + */ + public static String decryptDataOnJava(String data, String PRIVATEKEY) { + String temp = ""; + try { + byte[] rs = Base64Utils.decode(data); + temp = new String(RSAUtils.decryptByPrivateKey(rs, PRIVATEKEY),"UTF-8"); //以utf-8的方式生成字符串 + + } catch (Exception e) { + e.printStackTrace(); + } + return temp; + } + + public static void main(String[] args) { + Map keyMap = null; + try { + keyMap = RSAUtils.genKeyPair(); + String publicKey = RSAUtils.getPublicKey(keyMap); + String privateKey = RSAUtils.getPrivateKey(keyMap); + System.err.println("公钥: \n\r" + publicKey); + System.err.println("私钥: \n\r" + privateKey); +// 公钥: +// MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDE8aNkz3X5f96bW2EJ3fRQsEmtgrIzLSCSJZLf1WBay0ihEideK45md5UZIFB6HSWwBaKD4z1uAMdt5esn0AIvrQS8+nlnB+Fohzxg7yY2ooDLP2az0WVKzepbeg8igq+jflUh7/+rvndiJAnv+mnMbibFqhYsDAJ3Zq82FkOeXQIDAQAB +// 私钥: +// MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMTxo2TPdfl/3ptbYQnd9FCwSa2CsjMtIJIlkt/VYFrLSKESJ14rjmZ3lRkgUHodJbAFooPjPW4Ax23l6yfQAi+tBLz6eWcH4WiHPGDvJjaigMs/ZrPRZUrN6lt6DyKCr6N+VSHv/6u+d2IkCe/6acxuJsWqFiwMAndmrzYWQ55dAgMBAAECgYB1gfPKz5oFjw0ERyaEG6GNj1G2rFek/1UCvlZ/JTJDmi0wpcNFhdmGO+2DO2upIMD+4K3R4YEipGZZpSiE7bCPM1uIerVAi0efTQMZKSrreud29Z/6xN0166GthAj30AjrwxfNAhoUNQXcG2NQJmfUpPlV95Cjh2b6tTlLdU9foQJBAO2zrzYeLiBrhEOZqr5JC8zUdseGSKCwIvZDwQ+s8GuuSVpm1q9mHOL3TODNlawfst78o9QBkk2MyKP7Voe6C6UCQQDUGr/A7XTvV39fqO4V+BcSLDCpxTHJ8UUWiRovXhDMn0TjqeRnDiRC9YuMf5XCXwDkYnK/u3O2maZugrcgUqpZAkBgd4zC9MqZg6jg2mtN4E02qn8uCFRPSkxWDzc5ymCkAs5oLtYvxswwXFbJ4QU+Hns0Pemq75xVdq4yxpzeZmW1AkEAvOi+FJTpaypg9dA9jS+TTMoy5WIOgC/1OqcNvVZoW/cWojZ0iRzdSw3rJk2UErQO1VqhnQbVfrLGuvKNK6q0sQJATbmrgK1KDaAS3Ns8MI6pDKWWHaAy8Vrnwz4nRIX2C0FKLTYwbNPrvVHdpD0ItZ8p9wiAL6HVn5ipxbz6v0l1uA== + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/RedisKeys.java b/review_repo/src/main/java/com/zcloud/common/utils/RedisKeys.java new file mode 100644 index 0000000..5c744dc --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/RedisKeys.java @@ -0,0 +1,15 @@ + + +package com.zcloud.common.utils; + +/** + * Redis所有Keys + * + * + */ +public class RedisKeys { + + public static String getSysConfigKey(String key){ + return "sys:config:" + key; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/RedisUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/RedisUtils.java new file mode 100644 index 0000000..050dfe2 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/RedisUtils.java @@ -0,0 +1,93 @@ + + +package com.zcloud.common.utils; + +import com.google.gson.Gson; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.*; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * Redis工具类 + * + * + */ +@Component +public class RedisUtils { + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private ValueOperations valueOperations; + @Autowired + private HashOperations hashOperations; + @Autowired + private ListOperations listOperations; + @Autowired + private SetOperations setOperations; + @Autowired + private ZSetOperations zSetOperations; + /** 默认过期时长,单位:秒 */ + public final static long DEFAULT_EXPIRE = 60 * 60 * 24; + /** 不设置过期时长 */ + public final static long NOT_EXPIRE = -1; + private final static Gson gson = new Gson(); + + public void set(String key, Object value, long expire){ + valueOperations.set(key, toJson(value)); + if(expire != NOT_EXPIRE){ + redisTemplate.expire(key, expire, TimeUnit.SECONDS); + } + } + + public void set(String key, Object value){ + set(key, value, DEFAULT_EXPIRE); + } + + public T get(String key, Class clazz, long expire) { + String value = valueOperations.get(key); + if(expire != NOT_EXPIRE){ + redisTemplate.expire(key, expire, TimeUnit.SECONDS); + } + return value == null ? null : fromJson(value, clazz); + } + + public T get(String key, Class clazz) { + return get(key, clazz, NOT_EXPIRE); + } + + public String get(String key, long expire) { + String value = valueOperations.get(key); + if(expire != NOT_EXPIRE){ + redisTemplate.expire(key, expire, TimeUnit.SECONDS); + } + return value; + } + + public String get(String key) { + return get(key, NOT_EXPIRE); + } + + public void delete(String key) { + redisTemplate.delete(key); + } + + /** + * Object转成JSON数据 + */ + private String toJson(Object object){ + if(object instanceof Integer || object instanceof Long || object instanceof Float || + object instanceof Double || object instanceof Boolean || object instanceof String){ + return String.valueOf(object); + } + return gson.toJson(object); + } + + /** + * JSON数据,转成Object + */ + private T fromJson(String json, Class clazz){ + return gson.fromJson(json, clazz); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/ShiroUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/ShiroUtils.java new file mode 100644 index 0000000..606d0ba --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/ShiroUtils.java @@ -0,0 +1,51 @@ +package com.zcloud.common.utils; + +import com.zcloud.common.exception.ZException; +import com.zcloud.modules.sys.entity.SysUserEntity; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.session.Session; +import org.apache.shiro.subject.Subject; + +/** + * Shiro工具类 + */ +public class ShiroUtils { + + public static Session getSession() { + return SecurityUtils.getSubject().getSession(); + } + + public static Subject getSubject() { + return SecurityUtils.getSubject(); + } + + public static SysUserEntity getUserEntity() { + return (SysUserEntity)SecurityUtils.getSubject().getPrincipal(); + } + + public static String getUserId() { + return getUserEntity().getUserId(); + } + + public static void setSessionAttribute(Object key, Object value) { + getSession().setAttribute(key, value); + } + + public static Object getSessionAttribute(Object key) { + return getSession().getAttribute(key); + } + + public static boolean isLogin() { + return SecurityUtils.getSubject().getPrincipal() != null; + } + + public static String getKaptcha(String key) { + Object kaptcha = getSessionAttribute(key); + if(kaptcha == null){ + throw new ZException("验证码已失效"); + } + getSession().removeAttribute(key); + return kaptcha.toString(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/SpringContextUtils.java b/review_repo/src/main/java/com/zcloud/common/utils/SpringContextUtils.java new file mode 100644 index 0000000..eceb9bf --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/SpringContextUtils.java @@ -0,0 +1,45 @@ + + +package com.zcloud.common.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * Spring Context 工具类 + * + * + */ +@Component +public class SpringContextUtils implements ApplicationContextAware { + public static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + SpringContextUtils.applicationContext = applicationContext; + } + + public static Object getBean(String name) { + return applicationContext.getBean(name); + } + + public static T getBean(String name, Class requiredType) { + return applicationContext.getBean(name, requiredType); + } + + public static boolean containsBean(String name) { + return applicationContext.containsBean(name); + } + + public static boolean isSingleton(String name) { + return applicationContext.isSingleton(name); + } + + public static Class getType(String name) { + return applicationContext.getType(name); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/Tools.java b/review_repo/src/main/java/com/zcloud/common/utils/Tools.java new file mode 100644 index 0000000..a8b9b1d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/Tools.java @@ -0,0 +1,311 @@ +package com.zcloud.common.utils; + +import org.springframework.web.multipart.MultipartFile; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +/** + * 说明:常用工具 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class Tools { + + /** + * 随机生成六位数验证码 + * @return + */ + public static int getRandomNum(){ + Random r = new Random(); + return r.nextInt(900000)+100000;//(Math.random()*(999999-100000)+100000) + } + + /** + * 随机生成四位数验证码 + * @return + */ + public static int getRandomNum4(){ + Random r = new Random(); + return r.nextInt(9000)+1000; + } + + /** + * 检测字符串是否不为空(null,"","null") + * @param s + * @return 不为空则返回true,否则返回false + */ + public static boolean notEmpty(String s){ + return s!=null && !"".equals(s) && !"null".equals(s); + } + + /** + * 检测字符串是否为空(null,"","null") + * @param s + * @return 为空则返回true,不否则返回false + */ + public static boolean isEmpty(String s){ + return s==null || "".equals(s) || "null".equals(s); + } + public static boolean isEmpty (Object obj) { + return obj ==null || "".equals(obj); + } + /** + * 字符串转换为字符串数组 + * @param str 字符串 + * @param splitRegex 分隔符 + * @return + */ + public static String[] str2StrArray(String str,String splitRegex){ + if(isEmpty(str)){ + return null; + } + return str.split(splitRegex); + } + + /** + * 用默认的分隔符(,)将字符串转换为字符串数组 + * @param str 字符串 + * @return + */ + public static String[] str2StrArray(String str){ + return str2StrArray(str,",\\s*"); + } + + /** + * 验证邮箱 + * @param email + * @return + */ + public static boolean checkEmail(String email){ + boolean flag = false; + try{ + String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; + Pattern regex = Pattern.compile(check); + Matcher matcher = regex.matcher(email); + flag = matcher.matches(); + }catch(Exception e){ + flag = false; + } + return flag; + } + + /** + * 验证手机号码 + * @param mobileNumber + * @return + */ + public static boolean checkMobileNumber(String mobileNumber){ + boolean flag = false; + try{ + Pattern regex = Pattern.compile("^(((13[0-9])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8})|(0\\d{2}-\\d{8})|(0\\d{3}-\\d{7})$"); + Matcher matcher = regex.matcher(mobileNumber); + flag = matcher.matches(); + }catch(Exception e){ + flag = false; + } + return flag; + } + + /** + * 检测KEY是否正确 + * @param paraname 传入参数 + * @param FKEY 接收的 KEY + * @return 为空则返回true,不否则返回false + */ + public static boolean checkKey(String paraname, String FKEY){ + paraname = (null == paraname)? "":paraname; + return MD5.md5(paraname+DateUtil.getDays()+",fh,").equals(FKEY); + } + /** + 转半角的函数(DBC case)

    + 全角空格为12288,半角空格为32 + 其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248 + * @param input 任意字符串 + * @return 半角字符串 + * + */ + public static String ToDBC(String input) { + char[] c = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == 12288) { + //全角空格为12288,半角空格为32 + c[i] = (char) 32; + continue; + } + if (c[i] > 65280 && c[i] < 65375) + //其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248 + c[i] = (char) (c[i] - 65248); + } + return new String(c); + } + + public static String replaceBlank(String str) { + String dest = ""; + if (str != null) { + Pattern p = Pattern.compile("\\s*|\t|\r|\n"); + Matcher m = p.matcher(str); + dest = m.replaceAll(""); + } + return dest; + } + public static String excelHandle (String string) { + String aString = string.replaceAll(" ", ""); + aString = ToDBC(aString); + aString = replaceBlank(aString); + return aString; + } + public static String excelHandle (Object object) { + String aString = object.toString().replaceAll(" ", ""); + aString = ToDBC(aString); + aString = replaceBlank(aString); + return aString; + } + public static String get32UUID() { + String uuid = UUID.randomUUID().toString().trim().replaceAll("-", ""); + return uuid; + } + + public static String uploadFile(MultipartFile file, String folder) { + String ffile = DateUtil.getDays(); + String fileName = get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String path = "/uploadFiles/" + folder + "/" + ffile; + FileUploadUtil.sshSftp(file, fileName, path); + return "/uploadFiles/" + folder + "/" + ffile +"/" + fileName; + } + + public static boolean isNotBlank(Object obj){ + return obj!=null &&!"".equals(obj); + } + + + + /** + * 构建树形结构 + * + * @param entities 实体集合 + * idFieldName id字段名称 + * parentIdFieldName parentId字段名称 + * childrenFieldName children字段名称 + **/ + public static List buildEntityTree(List entities, String idFieldName, String parentIdFieldName, String childrenFieldName) { + if (entities == null || entities.isEmpty()) { + return new ArrayList<>(); + } + + List result = new ArrayList<>(); + + try { + Field idField = getField(entities.get(0).getClass(), idFieldName); + Field parentIdField = getField(entities.get(0).getClass(), parentIdFieldName); + Field childrenField = getField(entities.get(0).getClass(), childrenFieldName); + + if (idField == null || parentIdField == null) { + throw new IllegalArgumentException("Invalid idFieldName or parentIdFieldName or childrenField"); + } + + Map entityMap = new HashMap<>(); + for (T entity : entities) { + idField.setAccessible(true); + Object id = idField.get(entity); + entityMap.put(id, entity); + } + + for (T entity : entities) { + parentIdField.setAccessible(true); + Object parentId = parentIdField.get(entity); + if(parentId == null || parentId.equals("0") || parentId.equals("-1")){ + result.add(entity); // 根节点 + + }else{ + T parentEntity = entityMap.get(parentId); + if (parentEntity != null) { + if (childrenField != null) { + childrenField.setAccessible(true); + List children = (List) childrenField.get(parentEntity); + if (children == null) { + children = new ArrayList<>(); + } + children.add(entity); + childrenField.set(parentEntity, children); + } + } + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + return result; + } + + + private static Field getField(Class clazz, String fieldName) { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + // 若当前类不存在指定字段,则尝试从父类中获取 + Class superClass = clazz.getSuperclass(); + if (superClass != null && superClass != Object.class) { + return getField(superClass, fieldName); + } + } + return null; + } + + /** + * 获取文件的后缀名 + * + * @param fileName 文件名 + * @return 文件后缀名,如果没有后缀名则返回空字符串 + */ + public static String getFileExtension(String fileName) { + if (fileName == null || fileName.isEmpty()) { + return ""; + } + + int lastDotIndex = fileName.lastIndexOf('.'); + if (lastDotIndex == -1) { + return ""; // 没有后缀名 + } + + return fileName.substring(lastDotIndex + 1).toLowerCase(); + } + + public static String toString(Object obj) { + if (obj == null) { + return null; + } + return obj.toString(); + } + + public static Integer toInteger(Object obj) { + if (obj == null) { + return null; + } + return Integer.valueOf(obj.toString()); + } + + public static Double toDouble(Object obj) { + if (obj == null) { + return null; + } + return Double.valueOf(obj.toString()); + } + + /** + * 计算给定年份属于第几个周期。 + * @param startYear 起始年份 + * @param year 给定的年份 + * @param cycle 周期数 + * @return 返回周期编号 + */ + public static int calculateCycle(int startYear,int year,int cycle) { + int yearsDifference = year - startYear; + return yearsDifference / cycle + 1; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/utils/VerifyCodeUtil.java b/review_repo/src/main/java/com/zcloud/common/utils/VerifyCodeUtil.java new file mode 100644 index 0000000..23dddc6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/utils/VerifyCodeUtil.java @@ -0,0 +1,259 @@ +package com.zcloud.common.utils; + +import org.apache.logging.log4j.util.Base64Util; + +import javax.imageio.ImageIO; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.Random; + +public class VerifyCodeUtil { + //使用到Algerian字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符 + public static final String VERIFY_CODES = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ"; + private static Random random = new Random(); + + /** + * 使用系统默认字符源生成验证码 + * + * @param verifySize 验证码长度 + * @return + */ + public static String generateVerifyCode(int verifySize) { + return generateVerifyCode(verifySize, VERIFY_CODES); + } + + /** + * 使用指定源生成验证码 + * + * @param verifySize 验证码长度 + * @param sources 验证码字符源 + * @return + */ + public static String generateVerifyCode(int verifySize, String sources) { + if (sources == null || sources.length() == 0) { + sources = VERIFY_CODES; + } + int codesLen = sources.length(); + Random rand = new Random(System.currentTimeMillis()); + StringBuilder verifyCode = new StringBuilder(verifySize); + for (int i = 0; i < verifySize; i++) { + verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1))); + } + return verifyCode.toString(); + } + + /** + * 生成指定数据的验证码并以Base64编码一字符串形式返回,用于前后分离 + * @param w + * @param h + * @param code + * @return + * @throws IOException + */ + public static String outputImage(int w, int h, String code) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + VerifyCodeUtil.outputImage(100, 39, baos, code); + final String BASE64_IMAGE = "data:image/jpeg;base64,%s"; + String base64Img = String.format(BASE64_IMAGE, Base64Util.encode(Arrays.toString(baos.toByteArray()))); + return base64Img; + } + + + /** + * 生成指定验证码图像文件 + * + * @param w + * @param h + * @param outputFile + * @param code + * @throws IOException + */ + public static void outputImage(int w, int h, File outputFile, String code) throws IOException { + if (outputFile == null) { + return; + } + File dir = outputFile.getParentFile(); + if (!dir.exists()) { + dir.mkdirs(); + } + try { + outputFile.createNewFile(); + FileOutputStream fos = new FileOutputStream(outputFile); + outputImage(w, h, fos, code); + fos.close(); + } catch (IOException e) { + throw e; + } + } + + /** + * 输出指定验证码图片流 + * + * @param w + * @param h + * @param os + * @param code + * @throws IOException + */ + public static void outputImage(int w, int h, OutputStream os, String code) throws IOException { + int verifySize = code.length(); + BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + Random rand = new Random(); + Graphics2D g2 = image.createGraphics(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + Color[] colors = new Color[5]; + Color[] colorSpaces = new Color[]{Color.WHITE, Color.CYAN, + Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA, Color.ORANGE, + Color.PINK, Color.YELLOW}; + float[] fractions = new float[colors.length]; + for (int i = 0; i < colors.length; i++) { + colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)]; + fractions[i] = rand.nextFloat(); + } + Arrays.sort(fractions); + + g2.setColor(Color.GRAY);// 设置边框色 + g2.fillRect(0, 0, w, h); + + Color c = getRandColor(200, 250); + g2.setColor(c);// 设置背景色 + g2.fillRect(0, 2, w, h - 4); + + //绘制干扰线 + Random random = new Random(); + g2.setColor(getRandColor(160, 200));// 设置线条的颜色 + for (int i = 0; i < 20; i++) { + int x = random.nextInt(w - 1); + int y = random.nextInt(h - 1); + int xl = random.nextInt(6) + 1; + int yl = random.nextInt(12) + 1; + g2.drawLine(x, y, x + xl + 40, y + yl + 20); + } + + // 添加噪点 + float yawpRate = 0.05f;// 噪声率 + int area = (int) (yawpRate * w * h); + for (int i = 0; i < area; i++) { + int x = random.nextInt(w); + int y = random.nextInt(h); + int rgb = getRandomIntColor(); + image.setRGB(x, y, rgb); + } + + shear(g2, w, h, c);// 使图片扭曲 + + g2.setColor(getRandColor(100, 160)); + int fontSize = h - 6; + Font font = new Font("Algerian", Font.ITALIC, fontSize); + g2.setFont(font); + char[] chars = code.toCharArray(); + for (int i = 0; i < verifySize; i++) { + AffineTransform affine = new AffineTransform(); + affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1), (w / verifySize) * i + fontSize / 2, h / 2); + g2.setTransform(affine); + g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10); + } + + g2.dispose(); + ImageIO.write(image, "jpg", os); + } + + + private static Color getRandColor(int fc, int bc) { + if (fc > 255) { + fc = 255; + } + if (bc > 255) { + bc = 255; + } + int r = fc + random.nextInt(bc - fc); + int g = fc + random.nextInt(bc - fc); + int b = fc + random.nextInt(bc - fc); + return new Color(r, g, b); + } + + private static int getRandomIntColor() { + int[] rgb = getRandomRgb(); + int color = 0; + for (int c : rgb) { + color = color << 8; + color = color | c; + } + return color; + } + + private static int[] getRandomRgb() { + int[] rgb = new int[3]; + for (int i = 0; i < 3; i++) { + rgb[i] = random.nextInt(255); + } + return rgb; + } + + private static void shear(Graphics g, int w1, int h1, Color color) { + shearX(g, w1, h1, color); + shearY(g, w1, h1, color); + } + + private static void shearX(Graphics g, int w1, int h1, Color color) { + int period = random.nextInt(2); + + boolean borderGap = true; + int frames = 1; + int phase = random.nextInt(2); + + for (int i = 0; i < h1; i++) { + double d = (double) (period >> 1) + * Math.sin((double) i / (double) period + + (6.2831853071795862D * (double) phase) + / (double) frames); + g.copyArea(0, i, w1, 1, (int) d, 0); + if (borderGap) { + g.setColor(color); + g.drawLine((int) d, i, 0, i); + g.drawLine((int) d + w1, i, w1, i); + } + } + } + + private static void shearY(Graphics g, int w1, int h1, Color color) { + int period = random.nextInt(40) + 10; // 50; + boolean borderGap = true; + int frames = 20; + int phase = 7; + for (int i = 0; i < w1; i++) { + double d = (double) (period >> 1) + * Math.sin((double) i / (double) period + + (6.2831853071795862D * (double) phase) + / (double) frames); + g.copyArea(i, 0, 1, h1, 0, (int) d); + if (borderGap) { + g.setColor(color); + g.drawLine(i, (int) d, i, 0); + g.drawLine(i, (int) d + h1, i, h1); + } + } + } + + public static void main(String[] args) throws IOException { + File dir = new File("D:/upload/verifyCode"); + int w = 200, h = 80; + for (int i = 0; i < 50; i++) { + String verifyCode = generateVerifyCode(4); + File file = new File(dir, verifyCode + ".jpg"); + outputImage(w, h, file, verifyCode); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/Assert.java b/review_repo/src/main/java/com/zcloud/common/validator/Assert.java new file mode 100644 index 0000000..c20a786 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/Assert.java @@ -0,0 +1,26 @@ + + +package com.zcloud.common.validator; + +import com.zcloud.common.exception.ZException; +import org.apache.commons.lang.StringUtils; + +/** + * 数据校验 + * + * + */ +public abstract class Assert { + + public static void isBlank(String str, String message) { + if (StringUtils.isBlank(str)) { + throw new ZException(message); + } + } + + public static void isNull(Object object, String message) { + if (object == null) { + throw new ZException(message); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/ValidatorUtils.java b/review_repo/src/main/java/com/zcloud/common/validator/ValidatorUtils.java new file mode 100644 index 0000000..b9dbf3f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/ValidatorUtils.java @@ -0,0 +1,46 @@ +package com.zcloud.common.validator; + +import com.zcloud.common.exception.ZException; +import com.zcloud.common.utils.Constant; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import java.util.Set; + +/** + * hibernate-validator校验工具类 + * + * 参考文档:http://docs.jboss.org/hibernate/validator/5.4/reference/en-US/html_single/ + * + * + */ +public class ValidatorUtils { + private static Validator validator; + + static { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + /** + * 校验对象 + * @param object 待校验对象 + * @param groups 待校验的组 + * @throws ZException 校验不通过,则报RRException异常 + */ + public static void validateEntity(Object object, Class... groups) + throws ZException { + Set> constraintViolations = validator.validate(object, groups); + if (!constraintViolations.isEmpty()) { + StringBuilder msg = new StringBuilder(); + for (ConstraintViolation constraint : constraintViolations) { + msg.append(constraint.getMessage()).append("
    "); + } + throw new ZException(msg.toString()); + } + } + + public static void validateEntity(Object object, Constant.CloudService type) { + validateEntity(object, type.getValidatorGroupClass()); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/group/AddGroup.java b/review_repo/src/main/java/com/zcloud/common/validator/group/AddGroup.java new file mode 100644 index 0000000..bbb8374 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/group/AddGroup.java @@ -0,0 +1,11 @@ + + +package com.zcloud.common.validator.group; + +/** + * 新增数据 Group + * + * + */ +public interface AddGroup { +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/group/AliyunGroup.java b/review_repo/src/main/java/com/zcloud/common/validator/group/AliyunGroup.java new file mode 100644 index 0000000..1f1008f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/group/AliyunGroup.java @@ -0,0 +1,11 @@ + + +package com.zcloud.common.validator.group; + +/** + * 阿里云 + * + * + */ +public interface AliyunGroup { +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/group/Group.java b/review_repo/src/main/java/com/zcloud/common/validator/group/Group.java new file mode 100644 index 0000000..36fddc1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/group/Group.java @@ -0,0 +1,15 @@ + + +package com.zcloud.common.validator.group; + +import javax.validation.GroupSequence; + +/** + * 定义校验顺序,如果AddGroup组失败,则UpdateGroup组不会再校验 + * + * + */ +@GroupSequence({AddGroup.class, UpdateGroup.class}) +public interface Group { + +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/group/QcloudGroup.java b/review_repo/src/main/java/com/zcloud/common/validator/group/QcloudGroup.java new file mode 100644 index 0000000..4e0666b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/group/QcloudGroup.java @@ -0,0 +1,11 @@ + + +package com.zcloud.common.validator.group; + +/** + * 腾讯云 + * + * + */ +public interface QcloudGroup { +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/group/QiniuGroup.java b/review_repo/src/main/java/com/zcloud/common/validator/group/QiniuGroup.java new file mode 100644 index 0000000..20ac1b8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/group/QiniuGroup.java @@ -0,0 +1,11 @@ + + +package com.zcloud.common.validator.group; + +/** + * 七牛 + * + * + */ +public interface QiniuGroup { +} diff --git a/review_repo/src/main/java/com/zcloud/common/validator/group/UpdateGroup.java b/review_repo/src/main/java/com/zcloud/common/validator/group/UpdateGroup.java new file mode 100644 index 0000000..c9f8346 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/validator/group/UpdateGroup.java @@ -0,0 +1,9 @@ +package com.zcloud.common.validator.group; + +/** + * 更新数据 Group + */ + +public interface UpdateGroup { + +} diff --git a/review_repo/src/main/java/com/zcloud/common/xss/HTMLFilter.java b/review_repo/src/main/java/com/zcloud/common/xss/HTMLFilter.java new file mode 100644 index 0000000..cbfd9a0 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/xss/HTMLFilter.java @@ -0,0 +1,530 @@ +package com.zcloud.common.xss; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * + * HTML filtering utility for protecting against XSS (Cross Site Scripting). + * + * This code is licensed LGPLv3 + * + * This code is a Java port of the original work in PHP by Cal Hendersen. + * http://code.iamcal.com/php/lib_filter/ + * + * The trickiest part of the translation was handling the differences in regex handling + * between PHP and Java. These resources were helpful in the process: + * + * http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html + * http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php + * http://www.regular-expressions.info/modifiers.html + * + * A note on naming conventions: instance variables are prefixed with a "v"; global + * constants are in all caps. + * + * Sample use: + * String input = ... + * String clean = new HTMLFilter().filter( input ); + * + * The class is not thread safe. Create a new instance if in doubt. + * + * If you find bugs or have suggestions on improvement (especially regarding + * performance), please contact us. The latest version of this + * source, and our contact details, can be found at http://xss-html-filter.sf.net + * + * @author Joseph O'Connell + * @author Cal Hendersen + * @author Michael Semb Wever + */ +public final class HTMLFilter { + + /** regex flag union representing /si modifiers in php **/ + private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; + private static final Pattern P_COMMENTS = Pattern.compile("", Pattern.DOTALL); + private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); + private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); + private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); + private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); + private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); + private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); + private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); + private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); + private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); + private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); + private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); + private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); + private static final Pattern P_END_ARROW = Pattern.compile("^>"); + private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_AMP = Pattern.compile("&"); + private static final Pattern P_QUOTE = Pattern.compile("<"); + private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); + private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); + private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); + + // @xxx could grow large... maybe use sesat's ReferenceMap + private static final ConcurrentMap P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap(); + private static final ConcurrentMap P_REMOVE_SELF_BLANKS = new ConcurrentHashMap(); + + /** set of allowed html elements, along with allowed attributes for each element **/ + private final Map> vAllowed; + /** counts of open tags for each (allowable) html element **/ + private final Map vTagCounts = new HashMap(); + + /** html elements which must always be self-closing (e.g. "") **/ + private final String[] vSelfClosingTags; + /** html elements which must always have separate opening and closing tags (e.g. "") **/ + private final String[] vNeedClosingTags; + /** set of disallowed html elements **/ + private final String[] vDisallowed; + /** attributes which should be checked for valid protocols **/ + private final String[] vProtocolAtts; + /** allowed protocols **/ + private final String[] vAllowedProtocols; + /** tags which should be removed if they contain no content (e.g. "" or "") **/ + private final String[] vRemoveBlanks; + /** entities allowed within html markup **/ + private final String[] vAllowedEntities; + /** flag determining whether comments are allowed in input String. */ + private final boolean stripComment; + private final boolean encodeQuotes; + private boolean vDebug = false; + /** + * flag determining whether to try to make tags when presented with "unbalanced" + * angle brackets (e.g. "" becomes " text "). If set to false, + * unbalanced angle brackets will be html escaped. + */ + private final boolean alwaysMakeTags; + + /** Default constructor. + * + */ + public HTMLFilter() { + vAllowed = new HashMap<>(); + + final ArrayList a_atts = new ArrayList(); + a_atts.add("href"); + a_atts.add("target"); + vAllowed.put("a", a_atts); + + final ArrayList img_atts = new ArrayList(); + img_atts.add("src"); + img_atts.add("width"); + img_atts.add("height"); + img_atts.add("alt"); + vAllowed.put("img", img_atts); + + final ArrayList no_atts = new ArrayList(); + vAllowed.put("b", no_atts); + vAllowed.put("strong", no_atts); + vAllowed.put("i", no_atts); + vAllowed.put("em", no_atts); + + vSelfClosingTags = new String[]{"img"}; + vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"}; + vDisallowed = new String[]{}; + vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp. + vProtocolAtts = new String[]{"src", "href"}; + vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"}; + vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"}; + stripComment = true; + encodeQuotes = true; + alwaysMakeTags = true; + } + + /** Set debug flag to true. Otherwise use default settings. See the default constructor. + * + * @param debug turn debug on with a true argument + */ + public HTMLFilter(final boolean debug) { + this(); + vDebug = debug; + + } + + /** Map-parameter configurable constructor. + * + * @param conf map containing configuration. keys match field names. + */ + public HTMLFilter(final Map conf) { + + assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; + assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; + assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; + assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; + assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; + assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; + assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; + assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; + + vAllowed = Collections.unmodifiableMap((HashMap>) conf.get("vAllowed")); + vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); + vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); + vDisallowed = (String[]) conf.get("vDisallowed"); + vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); + vProtocolAtts = (String[]) conf.get("vProtocolAtts"); + vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); + vAllowedEntities = (String[]) conf.get("vAllowedEntities"); + stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; + encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; + alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; + } + + private void reset() { + vTagCounts.clear(); + } + + private void debug(final String msg) { + if (vDebug) { + Logger.getAnonymousLogger().info(msg); + } + } + + //--------------------------------------------------------------- + // my versions of some PHP library functions + public static String chr(final int decimal) { + return String.valueOf((char) decimal); + } + + public static String htmlSpecialChars(final String s) { + String result = s; + result = regexReplace(P_AMP, "&", result); + result = regexReplace(P_QUOTE, """, result); + result = regexReplace(P_LEFT_ARROW, "<", result); + result = regexReplace(P_RIGHT_ARROW, ">", result); + return result; + } + + //--------------------------------------------------------------- + /** + * given a user submitted input String, filter out any invalid or restricted + * html. + * + * @param input text (i.e. submitted by a user) than may contain html + * @return "clean" version of input, with only valid, whitelisted html elements allowed + */ + public String filter(final String input) { + reset(); + String s = input; + + debug("************************************************"); + debug(" INPUT: " + input); + + s = escapeComments(s); + debug(" escapeComments: " + s); + + s = balanceHTML(s); + debug(" balanceHTML: " + s); + + s = checkTags(s); + debug(" checkTags: " + s); + + s = processRemoveBlanks(s); + debug("processRemoveBlanks: " + s); + + s = validateEntities(s); + debug(" validateEntites: " + s); + + debug("************************************************\n\n"); + return s; + } + + public boolean isAlwaysMakeTags(){ + return alwaysMakeTags; + } + + public boolean isStripComments(){ + return stripComment; + } + + private String escapeComments(final String s) { + final Matcher m = P_COMMENTS.matcher(s); + final StringBuffer buf = new StringBuffer(); + if (m.find()) { + final String match = m.group(1); //(.*?) + m.appendReplacement(buf, Matcher.quoteReplacement("")); + } + m.appendTail(buf); + + return buf.toString(); + } + + private String balanceHTML(String s) { + if (alwaysMakeTags) { + // + // try and form html + // + s = regexReplace(P_END_ARROW, "", s); + s = regexReplace(P_BODY_TO_END, "<$1>", s); + s = regexReplace(P_XML_CONTENT, "$1<$2", s); + + } else { + // + // escape stray brackets + // + s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); + s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); + + // + // the last regexp causes '<>' entities to appear + // (we need to do a lookahead assertion so that the last bracket can + // be used in the next pass of the regexp) + // + s = regexReplace(P_BOTH_ARROWS, "", s); + } + + return s; + } + + private String checkTags(String s) { + Matcher m = P_TAGS.matcher(s); + + final StringBuffer buf = new StringBuffer(); + while (m.find()) { + String replaceStr = m.group(1); + replaceStr = processTag(replaceStr); + m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); + } + m.appendTail(buf); + + s = buf.toString(); + + // these get tallied in processTag + // (remember to reset before subsequent calls to filter method) + for (String key : vTagCounts.keySet()) { + for (int ii = 0; ii < vTagCounts.get(key); ii++) { + s += ""; + } + } + + return s; + } + + private String processRemoveBlanks(final String s) { + String result = s; + for (String tag : vRemoveBlanks) { + if(!P_REMOVE_PAIR_BLANKS.containsKey(tag)){ + P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?>")); + } + result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); + if(!P_REMOVE_SELF_BLANKS.containsKey(tag)){ + P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); + } + result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); + } + + return result; + } + + private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) { + Matcher m = regex_pattern.matcher(s); + return m.replaceAll(replacement); + } + + private String processTag(final String s) { + // ending tags + Matcher m = P_END_TAG.matcher(s); + if (m.find()) { + final String name = m.group(1).toLowerCase(); + if (allowed(name)) { + if (!inArray(name, vSelfClosingTags)) { + if (vTagCounts.containsKey(name)) { + vTagCounts.put(name, vTagCounts.get(name) - 1); + return ""; + } + } + } + } + + // starting tags + m = P_START_TAG.matcher(s); + if (m.find()) { + final String name = m.group(1).toLowerCase(); + final String body = m.group(2); + String ending = m.group(3); + + //debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); + if (allowed(name)) { + String params = ""; + + final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); + final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); + final List paramNames = new ArrayList(); + final List paramValues = new ArrayList(); + while (m2.find()) { + paramNames.add(m2.group(1)); //([a-z0-9]+) + paramValues.add(m2.group(3)); //(.*?) + } + while (m3.find()) { + paramNames.add(m3.group(1)); //([a-z0-9]+) + paramValues.add(m3.group(3)); //([^\"\\s']+) + } + + String paramName, paramValue; + for (int ii = 0; ii < paramNames.size(); ii++) { + paramName = paramNames.get(ii).toLowerCase(); + paramValue = paramValues.get(ii); + +// debug( "paramName='" + paramName + "'" ); +// debug( "paramValue='" + paramValue + "'" ); +// debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); + + if (allowedAttribute(name, paramName)) { + if (inArray(paramName, vProtocolAtts)) { + paramValue = processParamProtocol(paramValue); + } + params += " " + paramName + "=\"" + paramValue + "\""; + } + } + + if (inArray(name, vSelfClosingTags)) { + ending = " /"; + } + + if (inArray(name, vNeedClosingTags)) { + ending = ""; + } + + if (ending == null || ending.length() < 1) { + if (vTagCounts.containsKey(name)) { + vTagCounts.put(name, vTagCounts.get(name) + 1); + } else { + vTagCounts.put(name, 1); + } + } else { + ending = " /"; + } + return "<" + name + params + ending + ">"; + } else { + return ""; + } + } + + // comments + m = P_COMMENT.matcher(s); + if (!stripComment && m.find()) { + return "<" + m.group() + ">"; + } + + return ""; + } + + private String processParamProtocol(String s) { + s = decodeEntities(s); + final Matcher m = P_PROTOCOL.matcher(s); + if (m.find()) { + final String protocol = m.group(1); + if (!inArray(protocol, vAllowedProtocols)) { + // bad protocol, turn into local anchor link instead + s = "#" + s.substring(protocol.length() + 1, s.length()); + if (s.startsWith("#//")) { + s = "#" + s.substring(3, s.length()); + } + } + } + + return s; + } + + private String decodeEntities(String s) { + StringBuffer buf = new StringBuffer(); + + Matcher m = P_ENTITY.matcher(s); + while (m.find()) { + final String match = m.group(1); + final int decimal = Integer.decode(match).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENTITY_UNICODE.matcher(s); + while (m.find()) { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENCODE.matcher(s); + while (m.find()) { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + s = validateEntities(s); + return s; + } + + private String validateEntities(final String s) { + StringBuffer buf = new StringBuffer(); + + // validate entities throughout the string + Matcher m = P_VALID_ENTITIES.matcher(s); + while (m.find()) { + final String one = m.group(1); //([^&;]*) + final String two = m.group(2); //(?=(;|&|$)) + m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); + } + m.appendTail(buf); + + return encodeQuotes(buf.toString()); + } + + private String encodeQuotes(final String s){ + if(encodeQuotes){ + StringBuffer buf = new StringBuffer(); + Matcher m = P_VALID_QUOTES.matcher(s); + while (m.find()) { + final String one = m.group(1); //(>|^) + final String two = m.group(2); //([^<]+?) + final String three = m.group(3); //(<|$) + m.appendReplacement(buf, Matcher.quoteReplacement(one + regexReplace(P_QUOTE, """, two) + three)); + } + m.appendTail(buf); + return buf.toString(); + }else{ + return s; + } + } + + private String checkEntity(final String preamble, final String term) { + + return ";".equals(term) && isValidEntity(preamble) + ? '&' + preamble + : "&" + preamble; + } + + private boolean isValidEntity(final String entity) { + return inArray(entity, vAllowedEntities); + } + + private static boolean inArray(final String s, final String[] array) { + for (String item : array) { + if (item != null && item.equals(s)) { + return true; + } + } + return false; + } + + private boolean allowed(final String name) { + return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); + } + + private boolean allowedAttribute(final String name, final String paramName) { + return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/xss/SQLFilter.java b/review_repo/src/main/java/com/zcloud/common/xss/SQLFilter.java new file mode 100644 index 0000000..426a73e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/xss/SQLFilter.java @@ -0,0 +1,44 @@ + + +package com.zcloud.common.xss; + +import com.zcloud.common.exception.ZException; +import org.apache.commons.lang.StringUtils; + +/** + * SQL过滤 + * + * + */ +public class SQLFilter { + + /** + * SQL注入过滤 + * @param str 待验证的字符串 + */ + public static String sqlInject(String str){ + if(StringUtils.isBlank(str)){ + return null; + } + //去掉'|"|;|\字符 + str = StringUtils.replace(str, "'", ""); + str = StringUtils.replace(str, "\"", ""); + str = StringUtils.replace(str, ";", ""); + str = StringUtils.replace(str, "\\", ""); + + //转换成小写 + str = str.toLowerCase(); + + //非法字符 + String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; + + //判断是否包含非法字符 + for(String keyword : keywords){ + if(str.indexOf(keyword) != -1){ + throw new ZException("包含非法字符"); + } + } + + return str; + } +} diff --git a/review_repo/src/main/java/com/zcloud/common/xss/XssFilter.java b/review_repo/src/main/java/com/zcloud/common/xss/XssFilter.java new file mode 100644 index 0000000..e1e596c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/xss/XssFilter.java @@ -0,0 +1,31 @@ + + +package com.zcloud.common.xss; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +/** + * XSS过滤 + * + * + */ +public class XssFilter implements Filter { + + @Override + public void init(FilterConfig config) throws ServletException { + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper( + (HttpServletRequest) request); + chain.doFilter(xssRequest, response); + } + + @Override + public void destroy() { + } + +} diff --git a/review_repo/src/main/java/com/zcloud/common/xss/XssHttpServletRequestWrapper.java b/review_repo/src/main/java/com/zcloud/common/xss/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000..a0b094d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/common/xss/XssHttpServletRequestWrapper.java @@ -0,0 +1,141 @@ + + +package com.zcloud.common.xss; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * XSS过滤处理 + * + * + */ +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { + //没被包装过的HttpServletRequest(特殊场景,需要自己过滤) + HttpServletRequest orgRequest; + //html过滤 + private final static HTMLFilter htmlFilter = new HTMLFilter(); + + public XssHttpServletRequestWrapper(HttpServletRequest request) { + super(request); + orgRequest = request; + } + + @Override + public ServletInputStream getInputStream() throws IOException { + //非json类型,直接返回 + if(!MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(super.getHeader(HttpHeaders.CONTENT_TYPE))){ + return super.getInputStream(); + } + + //为空,直接返回 + String json = IOUtils.toString(super.getInputStream(), "utf-8"); + if (StringUtils.isBlank(json)) { + return super.getInputStream(); + } + + //xss过滤 + json = xssEncode(json); + final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8")); + return new ServletInputStream() { + @Override + public boolean isFinished() { + return true; + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) { + + } + + @Override + public int read() throws IOException { + return bis.read(); + } + }; + } + + @Override + public String getParameter(String name) { + String value = super.getParameter(xssEncode(name)); + if (StringUtils.isNotBlank(value)) { + value = xssEncode(value); + } + return value; + } + + @Override + public String[] getParameterValues(String name) { + String[] parameters = super.getParameterValues(name); + if (parameters == null || parameters.length == 0) { + return null; + } + + for (int i = 0; i < parameters.length; i++) { + parameters[i] = xssEncode(parameters[i]); + } + return parameters; + } + + @Override + public Map getParameterMap() { + Map map = new LinkedHashMap<>(); + Map parameters = super.getParameterMap(); + for (String key : parameters.keySet()) { + String[] values = parameters.get(key); + for (int i = 0; i < values.length; i++) { + values[i] = xssEncode(values[i]); + } + map.put(key, values); + } + return map; + } + + @Override + public String getHeader(String name) { + String value = super.getHeader(xssEncode(name)); + if (StringUtils.isNotBlank(value)) { + value = xssEncode(value); + } + return value; + } + + private String xssEncode(String input) { + return htmlFilter.filter(input); + } + + /** + * 获取最原始的request + */ + public HttpServletRequest getOrgRequest() { + return orgRequest; + } + + /** + * 获取最原始的request + */ + public static HttpServletRequest getOrgRequest(HttpServletRequest request) { + if (request instanceof XssHttpServletRequestWrapper) { + return ((XssHttpServletRequestWrapper) request).getOrgRequest(); + } + + return request; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/config/CorsConfig.java b/review_repo/src/main/java/com/zcloud/config/CorsConfig.java new file mode 100644 index 0000000..3eec516 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/CorsConfig.java @@ -0,0 +1,20 @@ + + +package com.zcloud.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class CorsConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("*") + .allowCredentials(true) + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .maxAge(3600); + } +} diff --git a/review_repo/src/main/java/com/zcloud/config/FilterConfig.java b/review_repo/src/main/java/com/zcloud/config/FilterConfig.java new file mode 100644 index 0000000..8aacd32 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/FilterConfig.java @@ -0,0 +1,42 @@ + + +package com.zcloud.config; + +import com.zcloud.common.xss.XssFilter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.DelegatingFilterProxy; + +import javax.servlet.DispatcherType; + +/** + * Filter配置 + * + */ +@Configuration +public class FilterConfig { + + @Bean + public FilterRegistrationBean shiroFilterRegistration() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new DelegatingFilterProxy("shiroFilter")); + //该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理 + registration.addInitParameter("targetFilterLifecycle", "true"); + registration.setEnabled(true); + registration.setOrder(Integer.MAX_VALUE - 1); + registration.addUrlPatterns("/*"); + return registration; + } + + @Bean + public FilterRegistrationBean xssFilterRegistration() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setDispatcherTypes(DispatcherType.REQUEST); + registration.setFilter(new XssFilter()); + registration.addUrlPatterns("/*"); + registration.setName("xssFilter"); + registration.setOrder(Integer.MAX_VALUE); + return registration; + } +} diff --git a/review_repo/src/main/java/com/zcloud/config/KaptchaConfig.java b/review_repo/src/main/java/com/zcloud/config/KaptchaConfig.java new file mode 100644 index 0000000..041488c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/KaptchaConfig.java @@ -0,0 +1,32 @@ + + +package com.zcloud.config; + +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + + +/** + * 生成验证码配置 + * + */ +@Configuration +public class KaptchaConfig { + + @Bean + public DefaultKaptcha producer() { + Properties properties = new Properties(); + properties.put("kaptcha.border", "no"); + properties.put("kaptcha.textproducer.font.color", "black"); + properties.put("kaptcha.textproducer.char.space", "5"); + properties.put("kaptcha.textproducer.font.names", "Arial,Courier,cmr10,宋体,楷体,微软雅黑"); + Config config = new Config(properties); + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/review_repo/src/main/java/com/zcloud/config/MybatisPlusConfig.java b/review_repo/src/main/java/com/zcloud/config/MybatisPlusConfig.java new file mode 100644 index 0000000..45e68c8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/MybatisPlusConfig.java @@ -0,0 +1,25 @@ +package com.zcloud.config; + + +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * mybatis-plus配置 + * + */ +@Configuration +public class MybatisPlusConfig { + + /** + * 分页插件 + */ + @Bean + public PaginationInnerInterceptor paginationInterceptor() { + return new PaginationInnerInterceptor(); + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/config/RedisConfig.java b/review_repo/src/main/java/com/zcloud/config/RedisConfig.java new file mode 100644 index 0000000..9738579 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/RedisConfig.java @@ -0,0 +1,57 @@ + + +package com.zcloud.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.*; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +/** + * Redis配置 + * + * + */ +@Configuration +public class RedisConfig { + @Autowired + private RedisConnectionFactory factory; + + @Bean + public RedisTemplate redisTemplate() { + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashValueSerializer(new StringRedisSerializer()); + redisTemplate.setValueSerializer(new StringRedisSerializer()); + redisTemplate.setConnectionFactory(factory); + return redisTemplate; + } + + @Bean + public HashOperations hashOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForHash(); + } + + @Bean + public ValueOperations valueOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForValue(); + } + + @Bean + public ListOperations listOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForList(); + } + + @Bean + public SetOperations setOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForSet(); + } + + @Bean + public ZSetOperations zSetOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForZSet(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/config/RestTemplateConfig.java b/review_repo/src/main/java/com/zcloud/config/RestTemplateConfig.java new file mode 100644 index 0000000..3bb2d48 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/RestTemplateConfig.java @@ -0,0 +1,19 @@ +package com.zcloud.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + //启动时需要实例化该类的一个实例 + @Autowired + private RestTemplateBuilder builder; + //使用RestTemplateBuilder来实例化RestTemplate对象,Spring已经默认注入了RestTemplateBuilder实例 + @Bean + public RestTemplate restTemplate(){ + return builder.build(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/config/ShiroConfig.java b/review_repo/src/main/java/com/zcloud/config/ShiroConfig.java new file mode 100644 index 0000000..0e6694c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/ShiroConfig.java @@ -0,0 +1,78 @@ +package com.zcloud.config; + +import com.zcloud.modules.sys.oauth2.OAuth2Filter; +import com.zcloud.modules.sys.oauth2.OAuth2Realm; +import org.apache.shiro.mgt.SecurityManager; +import org.apache.shiro.spring.LifecycleBeanPostProcessor; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.Filter; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Shiro配置 + * + */ +@Configuration +public class ShiroConfig { + + @Bean("securityManager") + public SecurityManager securityManager(OAuth2Realm oAuth2Realm) { + DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); + securityManager.setRealm(oAuth2Realm); + securityManager.setRememberMeManager(null); + return securityManager; + } + + @Bean("shiroFilter") + public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) { + ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); + shiroFilter.setSecurityManager(securityManager); + + //oauth过滤 + Map filters = new HashMap<>(); + filters.put("oauth2", new OAuth2Filter()); + shiroFilter.setFilters(filters); + + Map filterMap = new LinkedHashMap<>(); + filterMap.put("/webjars/**", "anon"); + filterMap.put("/druid/**", "anon"); + filterMap.put("/app/**", "anon"); + filterMap.put("/busExercises/downExcel", "anon"); + filterMap.put("/busStudyTask/downExamExcel", "anon"); + filterMap.put("/sys/login", "anon"); + filterMap.put("/busVisitor/**", "anon"); + filterMap.put("/fireCheckList/**", "anon"); + filterMap.put("/sys/dictionaries/**", "anon"); + filterMap.put("/map/**/**", "anon"); +// filterMap.put("/swagger/**", "anon"); +// filterMap.put("/v2/api-docs", "anon"); +// filterMap.put("/swagger-ui.html", "anon"); +// filterMap.put("/swagger-resources/**", "anon"); + filterMap.put("/captcha.jpg", "anon"); +// filterMap.put("/aaa.txt", "anon"); + filterMap.put("/**", "oauth2"); + shiroFilter.setFilterChainDefinitionMap(filterMap); + + return shiroFilter; + } + + @Bean("lifecycleBeanPostProcessor") + public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { + return new LifecycleBeanPostProcessor(); + } + + @Bean + public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) { + AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor(); + advisor.setSecurityManager(securityManager); + return advisor; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/config/SwaggerConfig.java b/review_repo/src/main/java/com/zcloud/config/SwaggerConfig.java new file mode 100644 index 0000000..38e14d3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/config/SwaggerConfig.java @@ -0,0 +1,70 @@ + + +package com.zcloud.config; + +import com.google.common.base.Predicates; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.List; + +import static com.google.common.collect.Lists.newArrayList; + +@Configuration +//@EnableSwagger2 +public class SwaggerConfig implements WebMvcConfigurer { + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //加了ApiOperation注解的类,才生成接口文档 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + //包下的类,才生成接口文档 +// .apis(Predicates.or( +// RequestHandlerSelectors.basePackage("com.zcloud.modules.app.controller"), +// RequestHandlerSelectors.basePackage("com.zcloud.modules.sys.controller") +// )) + .paths(PathSelectors.any()) + .build() + .securitySchemes(security()); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("教育") + .description("文档") + .version("1.0.0") + .build(); + } + + private List security() { + return newArrayList( + new ApiKey("token", "token", "header") + ); + } + + @Bean + public Docket web_api_app() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.ant("/app/**")) + .build() + .groupName("APP") + .pathMapping("/"); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/annotation/DataSource.java b/review_repo/src/main/java/com/zcloud/datasource/annotation/DataSource.java new file mode 100644 index 0000000..2b258f4 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/annotation/DataSource.java @@ -0,0 +1,15 @@ +package com.zcloud.datasource.annotation; + +import java.lang.annotation.*; + +/** + * 多数据源注解 + * + */ +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface DataSource { + String value() default ""; +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/aspect/DataSourceAspect.java b/review_repo/src/main/java/com/zcloud/datasource/aspect/DataSourceAspect.java new file mode 100644 index 0000000..3496385 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/aspect/DataSourceAspect.java @@ -0,0 +1,61 @@ +package com.zcloud.datasource.aspect; + + +import com.zcloud.datasource.annotation.DataSource; +import com.zcloud.datasource.config.DynamicContextHolder; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** + * 多数据源,切面处理类 + */ +@Aspect +@Component +@Order(Ordered.HIGHEST_PRECEDENCE) +public class DataSourceAspect { + protected Logger logger = LoggerFactory.getLogger(getClass()); + + @Pointcut("@annotation(com.zcloud.datasource.annotation.DataSource) " + + "|| @within(com.zcloud.datasource.annotation.DataSource)") + public void dataSourcePointCut() { + + } + + @Around("dataSourcePointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + MethodSignature signature = (MethodSignature) point.getSignature(); + Class targetClass = point.getTarget().getClass(); + Method method = signature.getMethod(); + + DataSource targetDataSource = (DataSource)targetClass.getAnnotation(DataSource.class); + DataSource methodDataSource = method.getAnnotation(DataSource.class); + if(targetDataSource != null || methodDataSource != null){ + String value; + if(methodDataSource != null){ + value = methodDataSource.value(); + }else { + value = targetDataSource.value(); + } + + DynamicContextHolder.push(value); + logger.debug("set datasource is {}", value); + } + + try { + return point.proceed(); + } finally { + DynamicContextHolder.poll(); + logger.debug("clean datasource"); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/config/DynamicContextHolder.java b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicContextHolder.java new file mode 100644 index 0000000..88b8631 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicContextHolder.java @@ -0,0 +1,47 @@ +package com.zcloud.datasource.config; + +import java.util.ArrayDeque; +import java.util.Deque; + +/** + * 多数据源上下文 + */ +public class DynamicContextHolder { + @SuppressWarnings("unchecked") + private static final ThreadLocal> CONTEXT_HOLDER = new ThreadLocal() { + @Override + protected Object initialValue() { + return new ArrayDeque(); + } + }; + + /** + * 获得当前线程数据源 + * + * @return 数据源名称 + */ + public static String peek() { + return CONTEXT_HOLDER.get().peek(); + } + + /** + * 设置当前线程数据源 + * + * @param dataSource 数据源名称 + */ + public static void push(String dataSource) { + CONTEXT_HOLDER.get().push(dataSource); + } + + /** + * 清空当前线程数据源 + */ + public static void poll() { + Deque deque = CONTEXT_HOLDER.get(); + deque.poll(); + if (deque.isEmpty()) { + CONTEXT_HOLDER.remove(); + } + } + +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSource.java b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSource.java new file mode 100644 index 0000000..6e85f0d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSource.java @@ -0,0 +1,17 @@ +package com.zcloud.datasource.config; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * 多数据源 + * + * + */ +public class DynamicDataSource extends AbstractRoutingDataSource { + + @Override + protected Object determineCurrentLookupKey() { + return DynamicContextHolder.peek(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSourceConfig.java b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSourceConfig.java new file mode 100644 index 0000000..0effdd0 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSourceConfig.java @@ -0,0 +1,55 @@ +package com.zcloud.datasource.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.zcloud.datasource.properties.DataSourceProperties; +import com.zcloud.datasource.properties.DynamicDataSourceProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.HashMap; +import java.util.Map; + +/** + * 配置多数据源 + * + * + */ +@Configuration +@EnableConfigurationProperties(DynamicDataSourceProperties.class) +public class DynamicDataSourceConfig { + @Autowired + private DynamicDataSourceProperties properties; + + @Bean + @ConfigurationProperties(prefix = "spring.datasource.druid") + public DataSourceProperties dataSourceProperties() { + return new DataSourceProperties(); + } + + @Bean + public DynamicDataSource dynamicDataSource(DataSourceProperties dataSourceProperties) { + DynamicDataSource dynamicDataSource = new DynamicDataSource(); + dynamicDataSource.setTargetDataSources(getDynamicDataSource()); + + //默认数据源 + DruidDataSource defaultDataSource = DynamicDataSourceFactory.buildDruidDataSource(dataSourceProperties); + dynamicDataSource.setDefaultTargetDataSource(defaultDataSource); + + return dynamicDataSource; + } + + private Map getDynamicDataSource(){ + Map dataSourcePropertiesMap = properties.getDatasource(); + Map targetDataSources = new HashMap<>(dataSourcePropertiesMap.size()); + dataSourcePropertiesMap.forEach((k, v) -> { + DruidDataSource druidDataSource = DynamicDataSourceFactory.buildDruidDataSource(v); + targetDataSources.put(k, druidDataSource); + }); + + return targetDataSources; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSourceFactory.java b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSourceFactory.java new file mode 100644 index 0000000..ba36f1e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/config/DynamicDataSourceFactory.java @@ -0,0 +1,46 @@ +package com.zcloud.datasource.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.zcloud.datasource.properties.DataSourceProperties; + +import java.sql.SQLException; + +/** + * DruidDataSource + * + * + * @since 1.0.0 + */ +public class DynamicDataSourceFactory { + + public static DruidDataSource buildDruidDataSource(DataSourceProperties properties) { + DruidDataSource druidDataSource = new DruidDataSource(); + druidDataSource.setDriverClassName(properties.getDriverClassName()); + druidDataSource.setUrl(properties.getUrl()); + druidDataSource.setUsername(properties.getUsername()); + druidDataSource.setPassword(properties.getPassword()); + + druidDataSource.setInitialSize(properties.getInitialSize()); + druidDataSource.setMaxActive(properties.getMaxActive()); + druidDataSource.setMinIdle(properties.getMinIdle()); + druidDataSource.setMaxWait(properties.getMaxWait()); + druidDataSource.setTimeBetweenEvictionRunsMillis(properties.getTimeBetweenEvictionRunsMillis()); + druidDataSource.setMinEvictableIdleTimeMillis(properties.getMinEvictableIdleTimeMillis()); + druidDataSource.setMaxEvictableIdleTimeMillis(properties.getMaxEvictableIdleTimeMillis()); + druidDataSource.setValidationQuery(properties.getValidationQuery()); + druidDataSource.setValidationQueryTimeout(properties.getValidationQueryTimeout()); + druidDataSource.setTestOnBorrow(properties.isTestOnBorrow()); + druidDataSource.setTestOnReturn(properties.isTestOnReturn()); + druidDataSource.setPoolPreparedStatements(properties.isPoolPreparedStatements()); + druidDataSource.setMaxOpenPreparedStatements(properties.getMaxOpenPreparedStatements()); + druidDataSource.setSharePreparedStatements(properties.isSharePreparedStatements()); + + try { + druidDataSource.setFilters(properties.getFilters()); + druidDataSource.init(); + } catch (SQLException e) { + e.printStackTrace(); + } + return druidDataSource; + } +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/properties/DataSourceProperties.java b/review_repo/src/main/java/com/zcloud/datasource/properties/DataSourceProperties.java new file mode 100644 index 0000000..775dab8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/properties/DataSourceProperties.java @@ -0,0 +1,194 @@ +package com.zcloud.datasource.properties; + +/** + * 多数据源属性 + * + * + * @since 1.0.0 + */ +public class DataSourceProperties { + private String driverClassName; + private String url; + private String username; + private String password; + + /** + * Druid默认参数 + */ + private int initialSize = 2; + private int maxActive = 10; + private int minIdle = -1; + private long maxWait = 60 * 1000L; + private long timeBetweenEvictionRunsMillis = 60 * 1000L; + private long minEvictableIdleTimeMillis = 1000L * 60L * 30L; + private long maxEvictableIdleTimeMillis = 1000L * 60L * 60L * 7; + private String validationQuery = "select 1"; + private int validationQueryTimeout = -1; + private boolean testOnBorrow = false; + private boolean testOnReturn = false; + private boolean testWhileIdle = true; + private boolean poolPreparedStatements = false; + private int maxOpenPreparedStatements = -1; + private boolean sharePreparedStatements = false; + private String filters = "stat,wall"; + + public String getDriverClassName() { + return driverClassName; + } + + public void setDriverClassName(String driverClassName) { + this.driverClassName = driverClassName; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getInitialSize() { + return initialSize; + } + + public void setInitialSize(int initialSize) { + this.initialSize = initialSize; + } + + public int getMaxActive() { + return maxActive; + } + + public void setMaxActive(int maxActive) { + this.maxActive = maxActive; + } + + public int getMinIdle() { + return minIdle; + } + + public void setMinIdle(int minIdle) { + this.minIdle = minIdle; + } + + public long getMaxWait() { + return maxWait; + } + + public void setMaxWait(long maxWait) { + this.maxWait = maxWait; + } + + public long getTimeBetweenEvictionRunsMillis() { + return timeBetweenEvictionRunsMillis; + } + + public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) { + this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; + } + + public long getMinEvictableIdleTimeMillis() { + return minEvictableIdleTimeMillis; + } + + public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { + this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public long getMaxEvictableIdleTimeMillis() { + return maxEvictableIdleTimeMillis; + } + + public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) { + this.maxEvictableIdleTimeMillis = maxEvictableIdleTimeMillis; + } + + public String getValidationQuery() { + return validationQuery; + } + + public void setValidationQuery(String validationQuery) { + this.validationQuery = validationQuery; + } + + public int getValidationQueryTimeout() { + return validationQueryTimeout; + } + + public void setValidationQueryTimeout(int validationQueryTimeout) { + this.validationQueryTimeout = validationQueryTimeout; + } + + public boolean isTestOnBorrow() { + return testOnBorrow; + } + + public void setTestOnBorrow(boolean testOnBorrow) { + this.testOnBorrow = testOnBorrow; + } + + public boolean isTestOnReturn() { + return testOnReturn; + } + + public void setTestOnReturn(boolean testOnReturn) { + this.testOnReturn = testOnReturn; + } + + public boolean isTestWhileIdle() { + return testWhileIdle; + } + + public void setTestWhileIdle(boolean testWhileIdle) { + this.testWhileIdle = testWhileIdle; + } + + public boolean isPoolPreparedStatements() { + return poolPreparedStatements; + } + + public void setPoolPreparedStatements(boolean poolPreparedStatements) { + this.poolPreparedStatements = poolPreparedStatements; + } + + public int getMaxOpenPreparedStatements() { + return maxOpenPreparedStatements; + } + + public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements) { + this.maxOpenPreparedStatements = maxOpenPreparedStatements; + } + + public boolean isSharePreparedStatements() { + return sharePreparedStatements; + } + + public void setSharePreparedStatements(boolean sharePreparedStatements) { + this.sharePreparedStatements = sharePreparedStatements; + } + + public String getFilters() { + return filters; + } + + public void setFilters(String filters) { + this.filters = filters; + } +} diff --git a/review_repo/src/main/java/com/zcloud/datasource/properties/DynamicDataSourceProperties.java b/review_repo/src/main/java/com/zcloud/datasource/properties/DynamicDataSourceProperties.java new file mode 100644 index 0000000..5e55501 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/datasource/properties/DynamicDataSourceProperties.java @@ -0,0 +1,23 @@ +package com.zcloud.datasource.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * 多数据源属性 + * @since 1.0.0 + */ +@ConfigurationProperties(prefix = "dynamic") +public class DynamicDataSourceProperties { + private Map datasource = new LinkedHashMap<>(); + + public Map getDatasource() { + return datasource; + } + + public void setDatasource(Map datasource) { + this.datasource = datasource; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/CheckHiddenPushEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/CheckHiddenPushEntity.java new file mode 100644 index 0000000..876e5a8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/CheckHiddenPushEntity.java @@ -0,0 +1,17 @@ +package com.zcloud.modules.RyCheck.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("ry_check_hidden_push") +public class CheckHiddenPushEntity { + @TableId(type = IdType.NONE) + private String PUSH_ID; + + private String HIDDEN_ID; + private String PUSH_TIME; + private String DATA; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenCheckUserEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenCheckUserEntity.java new file mode 100644 index 0000000..0884e44 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenCheckUserEntity.java @@ -0,0 +1,37 @@ +package com.zcloud.modules.RyCheck.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("bus_hiddencheck") +public class HiddenCheckUserEntity { + @TableId(type = IdType.NONE) + private String HIDDENCHECK_ID; + + private String HIDDEN_ID; + + private String DEPARTMENT_ID; + + private String USER_ID; + + private String STATUS; + + private String CHECK_TIME; + private String CHECKDESCR; + + public HiddenCheckUserEntity() { + } + + public HiddenCheckUserEntity(String HIDDENCHECK_ID, String HIDDEN_ID, String DEPARTMENT_ID, String USER_ID, String STATUS, String CHECK_TIME, String CHECKDESCR) { + this.HIDDENCHECK_ID = HIDDENCHECK_ID; + this.HIDDEN_ID = HIDDEN_ID; + this.DEPARTMENT_ID = DEPARTMENT_ID; + this.USER_ID = USER_ID; + this.STATUS = STATUS; + this.CHECK_TIME = CHECK_TIME; + this.CHECKDESCR = CHECKDESCR; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenEntity.java new file mode 100644 index 0000000..5c5d915 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenEntity.java @@ -0,0 +1,130 @@ +package com.zcloud.modules.RyCheck.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("bus_hidden") +public class HiddenEntity { + @TableId(type = IdType.NONE) + private String HIDDEN_ID; + + private String SOURCE; + + private String RISK_UNIT; + + private String IDENTIFICATION; + + private String RISK_DESCR; + + private String RISK_POSITION; + + private String LEVEL; + + private String CHECK_CONTENT; + + private String HIDDENDESCR; + + private String HIDDENPART; + + private String CREATOR; + + private String CREATTIME; + + private String RECTIFYDESCR; + + private String RECTIFICATIONTYPE; + + private String RECTIFICATIONDEPT; + + private String RECTIFICATIONOR; + + private String RECTIFICATIONDEADLINE; + + private String RECTIFICATIONTIME; + + private String HIDDENLEVEL; + + private String STATE; + + private String CHECKDEPT; + + private String CHECKOR; + + private String CHECKTIME; + + private String CHECKDESCR; + + private String ISQUALIFIED; + + private String ISDELETE; + + private String CORPINFO_ID; + + private String HIDDENFINDDEPT; + + private String CHECKRECORD_ID; + + private String RECORDITEM_ID; + + private String RISKITEM_ID; + + private String REJECTREASON; + + private String REVIEWOR; + + private String REVIEWTIME; + + private String REVIEWDEPT; + + private String HAVESCHEME; + + private String LONGITUDE; + + private String LATITUDE; + + private String LISTMANAGER_ID; + + private String HIDDENTYPE; + + private String ISCONFIRM = "0"; + + private String CONFIRM_USER; + + private String CONFIRM_TIME; + + private String DISCOVERYTIME; + + private String INVESTMENT_FUNDS; + + private String HIDDENTYPE2; + + private String FOREIGN_ID; + + private String FINAL_CHECK; + + private String FINAL_CHECKOR; + + private String finalCheckTime; + + private String FINAL_CHECKDESCR; + + private String POSITIONDESC; + + private String ISRELEVANT = "0"; + + private String ISEXPIREREPAIR = "0"; + + private String EVALUATE_STAGE_START_TIME; + + /** + * 隐患照片 + */ + @TableField(exist = false) + private String HIDDEN_PICTURE; + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenUserEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenUserEntity.java new file mode 100644 index 0000000..5a4c560 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/HiddenUserEntity.java @@ -0,0 +1,34 @@ +package com.zcloud.modules.RyCheck.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("bus_hidden_user") +public class HiddenUserEntity { + @TableId(type = IdType.NONE) + private String HIDDENUSER_ID; + + private String HIDDEN_ID; + + private String USER_ID; + + private String TYPE; + + private String IS_MAIN; + + private String DEPARTMENT_ID; + + public HiddenUserEntity() { + } + + public HiddenUserEntity(String HIDDENUSER_ID, String HIDDEN_ID, String USER_ID, String TYPE, String IS_MAIN) { + this.HIDDENUSER_ID = HIDDENUSER_ID; + this.HIDDEN_ID = HIDDEN_ID; + this.USER_ID = USER_ID; + this.TYPE = TYPE; + this.IS_MAIN = IS_MAIN; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/ImgFilesEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/ImgFilesEntity.java new file mode 100644 index 0000000..9d00a16 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/ImgFilesEntity.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.RyCheck.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("bus_imgfiles") +public class ImgFilesEntity { + @TableId(type = IdType.NONE) + private String IMGFILES_ID; + private String FILEPATH; + private String TYPE; + private String FOREIGN_KEY; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckJhEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckJhEntity.java new file mode 100644 index 0000000..a6febfc --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckJhEntity.java @@ -0,0 +1,34 @@ +package com.zcloud.modules.RyCheck.entity.rycheck; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +// 点检计划 +@Data +@TableName("ry_check_jh") +public class RyCheckJhEntity { + @TableId(type = IdType.NONE) + private Long fid;// 主键fid + private String fjhname;// 计划名称 + private String ftypestr;//计划类型 + private String fbc;// 班次中文名称 + private String froleidstr;// 角色名称 + private String fadddate;//计划生成时间 + private String freason;// 未点检原因 + private String fdelReason;// 删除原因 + private String fstatestr;// 点检状态 + private String fspstatusstr;// 审批状态 + private String fspTypeStr;// 审批类型 + private String fsumitUserStr;// 提交人 + private String fsubmitDate;//提交时间 + private String fspUserStr;// 审批人 + private String fspDate;// 审批时间 + private String fuserstr;// 接单人 + private String fuserdate;// 接单时间 + private String fcurrentdeptstr;// 当前部门 + private String fmodiuserstr;// 修改人 + private String fmodidate;//修改时间 + private String childList;// 检查项 +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckJlEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckJlEntity.java new file mode 100644 index 0000000..cc367eb --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckJlEntity.java @@ -0,0 +1,148 @@ +package com.zcloud.modules.RyCheck.entity.rycheck; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.HashMap; +import java.util.List; + +// 点检记录 +@Data +@TableName("ry_check_jl") +public class RyCheckJlEntity { + @TableId(type = IdType.NONE) + private Long fid;//自增id, + private Long tempId; // 临时主键id + private Long fdjjhfid;//点检计划id, + private Long fsbid;//已绑定设备id, + private Long fdjbzid;//对应的点检标准id, + private Integer fdjstate;//是否发现问题(0 否 1 是), + private String fnote;//发现的问题及描述, + private Long fuser;//点检人员, + private String fdate;//点检时间, + private Integer fstate;//处理结果(0 忽略 1 待观察 2 转维修 3 维修完成(工单验收)), + private String fclnote;//处理意见, + private Integer fpj;//评价打分(1-5), + private Long fcluser;//处理操作人, + private String fcldate;//处理时间, + private Long zxid;//对应自修id, + private String dgcfid;//待观察主键id, + private String fzgyq;//整改要求, + private String longitude;//经度, + private String latitude;//纬度, + private String fdjstateStr;//是否发现问题(中文), + private String fuserStr;//点检人姓名, + private Long fuserDept;//点检人部门id, + private String fuserDeptStr;//点检人部门名称, + private String fuserPhone;//点检人联系电话, + private String fstateStr;//处理结果(中文), + private String fcluserStr;//操作人姓名, + private Long fcluserDept;//操作人部门id, + private String fcluserDeptStr;//操作人部门名称, + private String fcluserPhone;//操作人联系电话, + private String fbc;//班次, + private Integer ftype;//计划类型, + private String bzsFtype;//类型, + private String ftypeStr;//计划类型(中文), + private String fjhname;//计划名称, + private Long jhJduser;//计划接单人, + private String jhJduserStr;//计划接单人姓名, + private Long jhJduserDept;//计划接单人部门id, + private String jhJduserDeptStr;//计划接单人部门名称, + private String jhJduserPhone;//计划接单人联系电话, + private String jhJdsj;//计划接单时间, + private String freason;//未点检原因, + private String fsbidStr;//所绑定设备名称, + private String fcheckNote;//点检内容, + private String fmethodsNote;//检查方法, + private String toolname;//检查工具, + private String fcheckproject;//检查项目, + private String djbzName;//点检标准(中文), + // ---------------隐患------------------ + private String fgdno;//工单编号 ----- 维修, + private String fqfdept;//签发部门 --》CREATOR -》发现部门, + private String fqfdeptStr;//签发部门(中文), + private String fqfuser;//签发人id, + private String fqfuserStr;//签发人(中文) CREATOR -》发现人, + private Long fqfuserDept;//签发人部门id, + private String fqfuserDeptStr;//签发人部门(中文), + private String fqfuserPhone;//签发人联系电话, + private String fqfdate;//签发日期 CREATTIME -》发现时间, + private String fsbcode;//设备编号, + private String fsbcodeStr;//设备编号(中文), + private String fsbjg;//设备机构, + private String fsbjgStr;//设备机构(中文), + private String fsbzjg;//设备子机构, + private String fsbzjgStr;//设备子机构(中文), + private String fsbbj;//设备部件, + private String fsbbjStr;//设备部件(中文), + private String fsbyj;//设备元件fcode, + private String fsbyjStr;//设备元件字符串(中文), + private String zxNote;//发现问题及描述, ->HIDDENDESCR 隐患描述 + private String fwzbjcode;//设备部件代码, + private String fwzno;//物资编码, + private Integer zxState;//自修状态(1 正常;2 新装;3 替换;4 拆卸), + private String zxFstateStr;//自修状态(中文), + private String fstrdateJh;//计划开始时间, + private String fenddateJh;//计划结束时间, + private String fwxgyCode;//维修工艺代码, + private String fwxgyName;//维修工艺名称, + private String fwxgyFilename;//维修工艺文件名称, + private String fwxgyFilepath;//维修工艺文件路径, + private Integer fpattern;//派单模式(0 指派;1 抢单;2 技术员自修), + private String fpatternStr;//派单模式(中文), + private String fwwdw;//外委单位代码, + private String fwwdwStr;//外委单位名称, + private BigDecimal fwxry;//维修人数, + private String fwxfzr;//维修负责人 -》整改人, + private String fwxfzrTel;//维修负责人联系电话, + private String ys_user;//验收人, + private String fys_date;//验收时间, + private String fys_note;//验收说明, + private String fysDept; // 验收部门 + private String fysPhone; // 验收手机号 + private String fsbdl;//设备大类, + private String fsbdlStr;//设备大类(中文), + private BigDecimal fwzsl;//物资数量, + private BigDecimal fwzghsl;//物资归还数量, + private BigInteger fgdxh;//工单序号, + private String fsx;//时限, + private String fstrdateSj;//实际开始时间, + private String fenddateSj;//实际结束时间, + private String fckcode;//仓库代码(替换、拆卸模式下), + private String fckcodeStr;//仓库(中文;替换拆卸模式下), + private String fhwcode;//货位代码(替换、拆卸模式下), + private String fhwcodeStr;//货位(中文;替换拆卸模式下), + private String fcjcode;//层级代码, + private String fcjcodeStr;//层级(中文;替换拆卸模式下), + private Integer breakfire;//动火(0 否;1 是), + private String breakfireStr;//动火(中文), + private Integer highaltitude;//高空(0 否; 1 是), + private String highaltitudeStr;//高空(中文), + private Integer closed;//密闭(0 否;1 是), + private String closedStr;//密闭(中文), + private String fzdnote;//重点工作安排(中文), + private Integer fworkordertype;//工单类型(1 保养类;2 故障停机类;3 环保设施类), + private String fworkordertypeStr;//工单类型(中文), + private String fnodewzcode;//在线大件的物资id, + private Integer electricity;//停送电(0 否; 1 是), + private String electricityStr;//停送电(中文), + private String fphone;//联系电话(中文), + private Integer fcolor;//人员颜色(0 黄 1 橙 2 红), + private String fcolorStr;//人员颜色(中文), + private Integer fdz;//吊装(0 否; 1 是), + private String fdzStr;//吊装(中文), + private Integer flsyd;//临时用电(0 否; 1 是), + private String flsydStr;//临时用电(中文), + private Integer fdt;//动土(0 否; 1 是), + private String fdtStr;//动土(中文), + private Integer fdl;//断路(0 否; 1 是), + private String fdlStr;//断路(中文) + @TableField(exist = false) + private List fileList; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckMbEntity.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckMbEntity.java new file mode 100644 index 0000000..e88fa7f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/rycheck/RyCheckMbEntity.java @@ -0,0 +1,23 @@ +package com.zcloud.modules.RyCheck.entity.rycheck; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("ry_check_mb") +public class RyCheckMbEntity { + private Long fid; // 主键fid + private String fjhname;// 计划名称 + private String ftypestr;// 计划类型 + private String fdaytypeStr;// 计划周期 + private String froleidstr;// 角色名称 + private String fstatestr;// 启停状态 + private String isBusinessSystemStr;// 是否上传商务系统 + private String ftimestr;// 首次执行时间 + private String ftimenewstr;// 最新执行时间 + private String fadduserstr;// 添加人 + private String fadddatestr;// 添加时间 + private String fmodiuserstr;// 修改人 + private String fmodidatestr;// 修改时间 + private String childList; // 检查项信息 +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Department.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Department.java new file mode 100644 index 0000000..9e83034 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Department.java @@ -0,0 +1,168 @@ +package com.zcloud.modules.RyCheck.entity.system; + +import java.util.List; + +/** + * 说明:组织机构 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class Department { + + private String NAME; //名称 + private String NAME_EN; //英文名称 + private String BIANMA; //编码 + private String PARENT_ID; //上级ID + private String HEADMAN; //负责人 + private String TEL; //电话 + private String FUNCTIONS; //部门职能 + private String BZ; //备注 + private String ADDRESS; //地址 + private String DEPARTMENT_ID; //主键 + private String PROVINCE; //省 + private String CITY; //市 + private String COUNTRY; //区 + private String VILLAGE; //县 + private String TYPE; //类型 + private String LEVEL; //级别 + private String target; + private Department department; + private List subDepartment; + private boolean hasDepartment = false; + private String treeurl; + private String icon; + + public String getIcon() { + return icon; + } + public void setIcon(String icon) { + this.icon = icon; + } + public String getNAME() { + return NAME; + } + public void setNAME(String nAME) { + NAME = nAME; + } + public String getNAME_EN() { + return NAME_EN; + } + public void setNAME_EN(String nAME_EN) { + NAME_EN = nAME_EN; + } + public String getBIANMA() { + return BIANMA; + } + public void setBIANMA(String bIANMA) { + BIANMA = bIANMA; + } + public String getPARENT_ID() { + return PARENT_ID; + } + public void setPARENT_ID(String pARENT_ID) { + PARENT_ID = pARENT_ID; + } + public String getHEADMAN() { + return HEADMAN; + } + public void setHEADMAN(String hEADMAN) { + HEADMAN = hEADMAN; + } + public String getTEL() { + return TEL; + } + public void setTEL(String tEL) { + TEL = tEL; + } + public String getFUNCTIONS() { + return FUNCTIONS; + } + public void setFUNCTIONS(String fUNCTIONS) { + FUNCTIONS = fUNCTIONS; + } + public String getBZ() { + return BZ; + } + public void setBZ(String bZ) { + BZ = bZ; + } + public String getADDRESS() { + return ADDRESS; + } + public void setADDRESS(String aDDRESS) { + ADDRESS = aDDRESS; + } + public String getDEPARTMENT_ID() { + return DEPARTMENT_ID; + } + public void setDEPARTMENT_ID(String dEPARTMENT_ID) { + DEPARTMENT_ID = dEPARTMENT_ID; + } + public String getTarget() { + return target; + } + public void setTarget(String target) { + this.target = target; + } + public Department getDepartment() { + return department; + } + public void setDepartment(Department department) { + this.department = department; + } + public List getSubDepartment() { + return subDepartment; + } + public void setSubDepartment(List subDepartment) { + this.subDepartment = subDepartment; + } + public boolean isHasDepartment() { + return hasDepartment; + } + public void setHasDepartment(boolean hasDepartment) { + this.hasDepartment = hasDepartment; + } + public String getTreeurl() { + return treeurl; + } + public void setTreeurl(String treeurl) { + this.treeurl = treeurl; + } + public String getPROVINCE() { + return PROVINCE; + } + public void setPROVINCE(String pROVINCE) { + PROVINCE = pROVINCE; + } + public String getCITY() { + return CITY; + } + public void setCITY(String cITY) { + CITY = cITY; + } + public String getCOUNTRY() { + return COUNTRY; + } + public void setCOUNTRY(String cOUNTRY) { + COUNTRY = cOUNTRY; + } + public String getVILLAGE() { + return VILLAGE; + } + public void setVILLAGE(String vILLAGE) { + VILLAGE = vILLAGE; + } + public String getTYPE() { + return TYPE; + } + public void setTYPE(String tYPE) { + TYPE = tYPE; + } + public String getLEVEL() { + return LEVEL; + } + public void setLEVEL(String lEVEL) { + LEVEL = lEVEL; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/HiddenRegion.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/HiddenRegion.java new file mode 100644 index 0000000..309b3d4 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/HiddenRegion.java @@ -0,0 +1,156 @@ +package com.zcloud.modules.RyCheck.entity.system; + +import java.util.ArrayList; +import java.util.List; + +public class HiddenRegion { + private String HIDDENREGION_ID; //隐患区域ID + private String HIDDENREGION; //隐患区域 + private String PARENT_ID; //父级ID + + public String getHIDDENREGION_ID() { + return HIDDENREGION_ID; + } + + public void setHIDDENREGION_ID(String HIDDENREGION_ID) { + this.HIDDENREGION_ID = HIDDENREGION_ID; + } + + public void setChildhg(List childhg) { + this.childhg = childhg; + } + + private String PERSON_CHARGE; //负责人 + private int SORTINDEX; //排序 + private String COMMENTS; //备注 + private int ISDELETE; //是否删除 + private String CREATOR; //创建人 + private String CREATTIME; //创建时间 + private String OPERATOR; //修改人 + private String OPERATTIME; //修改时间 + private String HIDDENREGION_URL; //URL + private List subhiddenRegion; + private boolean hashiddenRegion = false; + + public String getCORPINFO_ID() { + return CORPINFO_ID; + } + + public void setCORPINFO_ID(String CORPINFO_ID) { + this.CORPINFO_ID = CORPINFO_ID; + } + + private String CORPINFO_ID; + + private List childhg = new ArrayList<>(); + + + + public String getHIDDENREGION() { + return HIDDENREGION; + } + + public void setHIDDENREGION(String HIDDENREGION) { + this.HIDDENREGION = HIDDENREGION; + } + + public String getPARENT_ID() { + return PARENT_ID; + } + + public void setPARENT_ID(String PARENT_ID) { + this.PARENT_ID = PARENT_ID; + } + + public String getPERSON_CHARGE() { + return PERSON_CHARGE; + } + + public void setPERSON_CHARGE(String PERSON_CHARGE) { + this.PERSON_CHARGE = PERSON_CHARGE; + } + + public int getSORTINDEX() { + return SORTINDEX; + } + + public void setSORTINDEX(int SORTINDEX) { + this.SORTINDEX = SORTINDEX; + } + + public String getCOMMENTS() { + return COMMENTS; + } + + public void setCOMMENTS(String COMMENTS) { + this.COMMENTS = COMMENTS; + } + + public int getISDELETE() { + return ISDELETE; + } + + public void setISDELETE(int ISDELETE) { + this.ISDELETE = ISDELETE; + } + + public String getCREATOR() { + return CREATOR; + } + + public void setCREATOR(String CREATOR) { + this.CREATOR = CREATOR; + } + + public String getCREATTIME() { + return CREATTIME; + } + + public void setCREATTIME(String CREATTIME) { + this.CREATTIME = CREATTIME; + } + + public String getOPERATOR() { + return OPERATOR; + } + + public void setOPERATOR(String OPERATOR) { + this.OPERATOR = OPERATOR; + } + + public String getOPERATTIME() { + return OPERATTIME; + } + + public void setOPERATTIME(String OPERATTIME) { + this.OPERATTIME = OPERATTIME; + } + + public List getChildhg() { + return childhg; + } + + public String getHIDDENREGION_URL() { + return HIDDENREGION_URL; + } + + public void setHIDDENREGION_URL(String HIDDENREGION_URL) { + this.HIDDENREGION_URL = HIDDENREGION_URL; + } + + public List getSubhiddenRegion() { + return subhiddenRegion; + } + + public void setSubhiddenRegion(List subhiddenRegion) { + this.subhiddenRegion = subhiddenRegion; + } + + public boolean isHashiddenRegion() { + return hashiddenRegion; + } + + public void setHashiddenRegion(boolean hashiddenRegion) { + this.hashiddenRegion = hashiddenRegion; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Menu.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Menu.java new file mode 100644 index 0000000..d1ee90e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Menu.java @@ -0,0 +1,125 @@ +package com.zcloud.modules.RyCheck.entity.system; + +import java.io.Serializable; +import java.util.List; + +/** + * 说明:菜单实体类 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class Menu implements Serializable { + + private static final long serialVersionUID = 1L; + + private String MENU_ID; //菜单ID + private String MENU_NAME; //菜单名称 + private String MENU_URL; //链接 + private String PARENT_ID; //上级菜单ID + private String MENU_ORDER; //排序 + private String MENU_ICON; //图标 + private String MENU_TYPE; //类型 + private String MENU_STATE; //菜单状态 + private String SHIRO_KEY; //权限标识 + private String SHOW_MODEL; //显示模式 + private String COMPONENT; //组件路径 + + private String target; + private Menu parentMenu; + private List subMenu; + private boolean hasMenu = false; + + public String getMENU_ID() { + return MENU_ID; + } + public void setMENU_ID(String mENU_ID) { + MENU_ID = mENU_ID; + } + public String getMENU_NAME() { + return MENU_NAME; + } + public void setMENU_NAME(String mENU_NAME) { + MENU_NAME = mENU_NAME; + } + public String getMENU_URL() { + return MENU_URL; + } + public void setMENU_URL(String mENU_URL) { + MENU_URL = mENU_URL; + } + public String getPARENT_ID() { + return PARENT_ID; + } + public void setPARENT_ID(String pARENT_ID) { + PARENT_ID = pARENT_ID; + } + public String getMENU_ORDER() { + return MENU_ORDER; + } + public void setMENU_ORDER(String mENU_ORDER) { + MENU_ORDER = mENU_ORDER; + } + public Menu getParentMenu() { + return parentMenu; + } + public void setParentMenu(Menu parentMenu) { + this.parentMenu = parentMenu; + } + public List getSubMenu() { + return subMenu; + } + public void setSubMenu(List subMenu) { + this.subMenu = subMenu; + } + public boolean isHasMenu() { + return hasMenu; + } + public void setHasMenu(boolean hasMenu) { + this.hasMenu = hasMenu; + } + public String getTarget() { + return target; + } + public void setTarget(String target) { + this.target = target; + } + public String getMENU_ICON() { + return MENU_ICON; + } + public void setMENU_ICON(String mENU_ICON) { + MENU_ICON = mENU_ICON; + } + public String getMENU_TYPE() { + return MENU_TYPE; + } + public void setMENU_TYPE(String mENU_TYPE) { + MENU_TYPE = mENU_TYPE; + } + + public String getSHIRO_KEY() { + return SHIRO_KEY; + } + public void setSHIRO_KEY(String sHIRO_KEY) { + SHIRO_KEY = sHIRO_KEY; + } + + public String getCOMPONENT() { + return COMPONENT; + } + public void setCOMPONENT(String cOMPONENT) { + COMPONENT = cOMPONENT; + } + + public String getMENU_STATE() { + return MENU_STATE; + } + public void setMENU_STATE(String mENU_STATE) { + MENU_STATE = mENU_STATE; + } + public String getSHOW_MODEL() { + return SHOW_MODEL; + } + public void setSHOW_MODEL(String sHOW_MODEL) { + SHOW_MODEL = sHOW_MODEL; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Role.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Role.java new file mode 100644 index 0000000..9dbc90f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/Role.java @@ -0,0 +1,75 @@ +package com.zcloud.modules.RyCheck.entity.system; + +/** + * 说明:角色实体类 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class Role { + private String ROLE_ID; //ID + private String ROLE_NAME; //名称 + private String RIGHTS; //权限(存放的除权后的菜单ID)控制菜单显示 + private String PARENT_ID; //上级ID + private String ADD_QX; //新增权限(存放的除权后的菜单ID)有新增权限的菜单ID + private String DEL_QX; //删除权限(存放的除权后的菜单ID)有删除权限的菜单ID + private String EDIT_QX; //修改权限(存放的除权后的菜单ID)有修改权限的菜单ID + private String CHA_QX; //查看权限(存放的除权后的菜单ID)有查看权限的菜单ID + private String RNUMBER; //编号(在处理类中新增的时候自动生成) + + public String getROLE_ID() { + return ROLE_ID; + } + public void setROLE_ID(String rOLE_ID) { + ROLE_ID = rOLE_ID; + } + public String getROLE_NAME() { + return ROLE_NAME; + } + public void setROLE_NAME(String rOLE_NAME) { + ROLE_NAME = rOLE_NAME; + } + public String getRIGHTS() { + return RIGHTS; + } + public void setRIGHTS(String rIGHTS) { + RIGHTS = rIGHTS; + } + public String getPARENT_ID() { + return PARENT_ID; + } + public void setPARENT_ID(String pARENT_ID) { + PARENT_ID = pARENT_ID; + } + public String getADD_QX() { + return ADD_QX; + } + public void setADD_QX(String aDD_QX) { + ADD_QX = aDD_QX; + } + public String getDEL_QX() { + return DEL_QX; + } + public void setDEL_QX(String dEL_QX) { + DEL_QX = dEL_QX; + } + public String getEDIT_QX() { + return EDIT_QX; + } + public void setEDIT_QX(String eDIT_QX) { + EDIT_QX = eDIT_QX; + } + public String getCHA_QX() { + return CHA_QX; + } + public void setCHA_QX(String cHA_QX) { + CHA_QX = cHA_QX; + } + public String getRNUMBER() { + return RNUMBER; + } + public void setRNUMBER(String rNUMBER) { + RNUMBER = rNUMBER; + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/User.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/User.java new file mode 100644 index 0000000..d1ec132 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/entity/system/User.java @@ -0,0 +1,99 @@ +package com.zcloud.modules.RyCheck.entity.system; + + +/** + * 说明:用户实体类 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class User { + private String USER_ID; //用户id + private String USERNAME; //用户名 + private String PASSWORD; //密码 + private String NAME; //姓名 + private String ROLE_ID; //角色id + private String ROLE_IDS; //副职角色id + private String CREATTIME; //创建时间 + private String LAST_LOGIN; //最后登录时间 + private String IP; //用户登录ip地址 + private String STATUS; //状态 + private Role role; //角色对象 + private String SKIN; //皮肤 + + public String getSKIN() { + return SKIN; + } + public void setSKIN(String sKIN) { + SKIN = sKIN; + } + + public String getUSER_ID() { + return USER_ID; + } + public void setUSER_ID(String uSER_ID) { + USER_ID = uSER_ID; + } + public String getUSERNAME() { + return USERNAME; + } + public void setUSERNAME(String uSERNAME) { + USERNAME = uSERNAME; + } + public String getPASSWORD() { + return PASSWORD; + } + public void setPASSWORD(String pASSWORD) { + PASSWORD = pASSWORD; + } + public String getNAME() { + return NAME; + } + public void setNAME(String nAME) { + NAME = nAME; + } + public String getROLE_ID() { + return ROLE_ID; + } + public void setROLE_ID(String rOLE_ID) { + ROLE_ID = rOLE_ID; + } + public String getROLE_IDS() { + return ROLE_IDS; + } + public void setROLE_IDS(String rOLE_IDS) { + ROLE_IDS = rOLE_IDS; + } + public String getLAST_LOGIN() { + return LAST_LOGIN; + } + public void setLAST_LOGIN(String lAST_LOGIN) { + LAST_LOGIN = lAST_LOGIN; + } + public String getIP() { + return IP; + } + public void setIP(String iP) { + IP = iP; + } + public String getSTATUS() { + return STATUS; + } + public void setSTATUS(String sTATUS) { + STATUS = sTATUS; + } + + public Role getRole() { + return role; + } + public void setRole(Role role) { + this.role = role; + } + + public String getCREATTIME() { + return CREATTIME; + } + + public void setCREATTIME(String CREATTIME) { + this.CREATTIME = CREATTIME; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/CheckHiddenPushMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/CheckHiddenPushMapper.java new file mode 100644 index 0000000..1dc7710 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/CheckHiddenPushMapper.java @@ -0,0 +1,13 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.CheckHiddenPushEntity; +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface CheckHiddenPushMapper extends BaseMapper { + List getWaitPushHidden(); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenCheckUserMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenCheckUserMapper.java new file mode 100644 index 0000000..3e485c8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenCheckUserMapper.java @@ -0,0 +1,9 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.HiddenCheckUserEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface HiddenCheckUserMapper extends BaseMapper { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenMapper.java new file mode 100644 index 0000000..d70ffbf --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenMapper.java @@ -0,0 +1,14 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.HiddenEntity; +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface HiddenMapper extends BaseMapper { + + List getAllUserList(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenUserMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenUserMapper.java new file mode 100644 index 0000000..8031e86 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/HiddenUserMapper.java @@ -0,0 +1,9 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.HiddenUserEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface HiddenUserMapper extends BaseMapper { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/ImgfilesMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/ImgfilesMapper.java new file mode 100644 index 0000000..b81421c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/ImgfilesMapper.java @@ -0,0 +1,13 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.ImgFilesEntity; +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface ImgfilesMapper extends BaseMapper { + List getAllImgList(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckJhMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckJhMapper.java new file mode 100644 index 0000000..5e5d5e8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckJhMapper.java @@ -0,0 +1,9 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckJhEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RyCheckJhMapper extends BaseMapper { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckJlMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckJlMapper.java new file mode 100644 index 0000000..0a8b278 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckJlMapper.java @@ -0,0 +1,9 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckJlEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RyCheckJlMapper extends BaseMapper { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckMbMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckMbMapper.java new file mode 100644 index 0000000..1165fca --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/RyCheckMbMapper.java @@ -0,0 +1,9 @@ +package com.zcloud.modules.RyCheck.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckMbEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RyCheckMbMapper extends BaseMapper { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/UserMapper.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/UserMapper.java new file mode 100644 index 0000000..c95b524 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/mapper/UserMapper.java @@ -0,0 +1,23 @@ +package com.zcloud.modules.RyCheck.mapper; + + +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface UserMapper{ + + List getAllUserList(PageData pd); + + List getAllUsers(PageData pd); + + List getAllDeptList(PageData pd); + + List getAllDepts(PageData pd); + + void addDept(PageData pageData); + + void saveUser(PageData pageData); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenCheckUserService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenCheckUserService.java new file mode 100644 index 0000000..ac85679 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenCheckUserService.java @@ -0,0 +1,7 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.HiddenCheckUserEntity; + +public interface HiddenCheckUserService extends IService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenPushService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenPushService.java new file mode 100644 index 0000000..f947b94 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenPushService.java @@ -0,0 +1,8 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.CheckHiddenPushEntity; + +public interface HiddenPushService extends IService { + void pushHidden(); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenService.java new file mode 100644 index 0000000..ed151dd --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenService.java @@ -0,0 +1,11 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.HiddenEntity; +import com.zcloud.modules.sys.entity.PageData; + +import java.util.List; + +public interface HiddenService extends IService { + List getAllUserList(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenUserService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenUserService.java new file mode 100644 index 0000000..2572e01 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/HiddenUserService.java @@ -0,0 +1,7 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.HiddenUserEntity; + +public interface HiddenUserService extends IService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckJhService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckJhService.java new file mode 100644 index 0000000..185a5f0 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckJhService.java @@ -0,0 +1,8 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckJhEntity; + +public interface RyCheckJhService extends IService { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckJlService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckJlService.java new file mode 100644 index 0000000..0d4cc35 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckJlService.java @@ -0,0 +1,8 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckJlEntity; + +public interface RyCheckJlService extends IService { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckMbService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckMbService.java new file mode 100644 index 0000000..fe96298 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckMbService.java @@ -0,0 +1,8 @@ +package com.zcloud.modules.RyCheck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckMbEntity; + +public interface RyCheckMbService extends IService { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckService.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckService.java new file mode 100644 index 0000000..5c08f1f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/RyCheckService.java @@ -0,0 +1,17 @@ +package com.zcloud.modules.RyCheck.service; + + +import com.zcloud.modules.sys.entity.PageData; + +public interface RyCheckService { + + void getRyCheckJlList(); + void getRyCheckJhList(); + + void getRyCheckRyMbList(); + + void pushedHiddenList(); + void getAllUser(); + void getAllDept(); + void getAllHidden(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenCheckUserServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenCheckUserServiceImpl.java new file mode 100644 index 0000000..81671dd --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenCheckUserServiceImpl.java @@ -0,0 +1,11 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.HiddenCheckUserEntity; +import com.zcloud.modules.RyCheck.mapper.HiddenCheckUserMapper; +import com.zcloud.modules.RyCheck.service.HiddenCheckUserService; +import org.springframework.stereotype.Service; + +@Service +public class HiddenCheckUserServiceImpl extends ServiceImpl implements HiddenCheckUserService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenPushServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenPushServiceImpl.java new file mode 100644 index 0000000..fee5306 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenPushServiceImpl.java @@ -0,0 +1,21 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.CheckHiddenPushEntity; +import com.zcloud.modules.RyCheck.mapper.CheckHiddenPushMapper; +import com.zcloud.modules.RyCheck.service.HiddenPushService; +import com.zcloud.modules.sys.entity.PageData; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class HiddenPushServiceImpl extends ServiceImpl implements HiddenPushService { + + + @Override + public void pushHidden() { + List waitHiddenList = baseMapper.getWaitPushHidden(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenServiceImpl.java new file mode 100644 index 0000000..e57ee72 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenServiceImpl.java @@ -0,0 +1,20 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.HiddenEntity; +import com.zcloud.modules.RyCheck.mapper.HiddenMapper; +import com.zcloud.modules.RyCheck.service.HiddenService; +import com.zcloud.modules.sys.entity.PageData; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class HiddenServiceImpl extends ServiceImpl implements HiddenService { + + + @Override + public List getAllUserList(PageData pd) { + return baseMapper.getAllUserList(pd); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenUserServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenUserServiceImpl.java new file mode 100644 index 0000000..f33cf09 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/HiddenUserServiceImpl.java @@ -0,0 +1,11 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.HiddenUserEntity; +import com.zcloud.modules.RyCheck.mapper.HiddenUserMapper; +import com.zcloud.modules.RyCheck.service.HiddenUserService; +import org.springframework.stereotype.Service; + +@Service +public class HiddenUserServiceImpl extends ServiceImpl implements HiddenUserService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckJhServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckJhServiceImpl.java new file mode 100644 index 0000000..31b1b14 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckJhServiceImpl.java @@ -0,0 +1,15 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckJhEntity; +import com.zcloud.modules.RyCheck.mapper.RyCheckJhMapper; +import com.zcloud.modules.RyCheck.service.RyCheckJhService; +import org.springframework.stereotype.Service; + + +/** + * @author lin + */ +@Service +public class RyCheckJhServiceImpl extends ServiceImpl implements RyCheckJhService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckJlServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckJlServiceImpl.java new file mode 100644 index 0000000..bdc7383 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckJlServiceImpl.java @@ -0,0 +1,12 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckJlEntity; +import com.zcloud.modules.RyCheck.mapper.RyCheckJlMapper; +import com.zcloud.modules.RyCheck.service.RyCheckJlService; +import org.springframework.stereotype.Service; + + +@Service +public class RyCheckJlServiceImpl extends ServiceImpl implements RyCheckJlService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckMbServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckMbServiceImpl.java new file mode 100644 index 0000000..b680888 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckMbServiceImpl.java @@ -0,0 +1,11 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.RyCheck.entity.rycheck.RyCheckMbEntity; +import com.zcloud.modules.RyCheck.mapper.RyCheckMbMapper; +import com.zcloud.modules.RyCheck.service.RyCheckMbService; +import org.springframework.stereotype.Service; + +@Service +public class RyCheckMbServiceImpl extends ServiceImpl implements RyCheckMbService { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckServiceImpl.java new file mode 100644 index 0000000..62c4bfb --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/RyCheck/service/impl/RyCheckServiceImpl.java @@ -0,0 +1,403 @@ +package com.zcloud.modules.RyCheck.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.zcloud.common.utils.Const; +import com.zcloud.common.utils.DateUtil; +import com.zcloud.common.utils.Tools; +import com.zcloud.modules.RyCheck.entity.*; +import com.zcloud.modules.RyCheck.entity.rycheck.*; +import com.zcloud.modules.RyCheck.mapper.ImgfilesMapper; +import com.zcloud.modules.RyCheck.mapper.UserMapper; +import com.zcloud.modules.RyCheck.service.*; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.util.*; +import org.apache.shiro.crypto.hash.SimpleHash; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +@Service +public class RyCheckServiceImpl implements RyCheckService { + + private static final Logger logger = LoggerFactory.getLogger(RyCheckServiceImpl.class); + @Resource + private RyCheckJlService ryCheckJlService; + @Resource + private RyCheckJhService ryCheckJhService; + @Resource + private RyCheckMbService ryCheckMbService; + @Resource + private HiddenService hiddenService; + @Resource + private HiddenUserService hiddenUserService; + @Resource + private HiddenCheckUserService hiddenCheckUserService; + @Resource + private UserMapper userMapper; + + @Resource + private ImgfilesMapper imgfilesMapper; + + private HashMap userMap; + private HashMap deptMap; + + @Override + @Transactional(rollbackFor = Exception.class) + public void getRyCheckJlList() { + ReturnMap httpResponseStr = HttpRequestUtilCheck.doPost("http://192.168.210.123:7016/jt_equipment/jt/getDjResultData"); + httpResponseStr.get("list"); + JSONArray dataList = (JSONArray) httpResponseStr.get("list"); + List ryCheckJlEntities = JSON.parseArray(dataList.toJSONString(), RyCheckJlEntity.class); + // 处理记录入库 + ryCheckJlService.saveBatch(ryCheckJlEntities); + // 转成隐患 turnIntoHidden danger + LinkedList hiddenList = turnIntoHidden(ryCheckJlEntities); + + // 增量数据 + List hiddenids = new ArrayList(); + for (HiddenEntity hidden : hiddenList) { + hiddenids.add(hidden.getHIDDEN_ID()); + } + if (!hiddenids.isEmpty()) { + PageData pageData = new PageData(); + pageData.put("HIDDEN_IDS", hiddenids.toArray(new String[hiddenids.size()])); + getAllHidden(pageData); + } + } + + private LinkedList turnIntoHidden(List ryCheckJlEntities) { + List allUserList = userMapper.getAllUserList(new PageData()); + userMap = new HashMap<>(); + allUserList.forEach(item -> { + userMap.put(item.getString("USERNAME"), item); + }); + List allDeptList = userMapper.getAllDeptList(new PageData()); + deptMap = new HashMap<>(); + allDeptList.forEach(item -> { + deptMap.put(item.getString("deptname"), item.getString("DEPARTMENT_ID")); + }); + // 处理工单转隐患存入系统 + LinkedList hiddenList = new LinkedList<>(); + // 发现人 + LinkedList hiddenUserList = new LinkedList<>(); + // 验收人 + LinkedList hiddenCheckUserList = new LinkedList<>(); + for (RyCheckJlEntity ryCheckJlEntity : ryCheckJlEntities) { + if (Tools.notEmpty(ryCheckJlEntity.getFgdno())) { + // 没有工单 不存隐患 + HiddenEntity hiddenEntity = new HiddenEntity(); + hiddenEntity.setHIDDEN_ID(UuidUtil.get32UUID()); + // 已验收 + hiddenEntity.setSTATE("4"); + hiddenEntity.setISDELETE("0"); + hiddenEntity.setCORPINFO_ID("8854edee3aa94be496cee676b6d4845a"); + // 期限整改 + // `RECTIFICATIONTYPE 1 立即整改 2 限期整改, + hiddenEntity.setRECTIFICATIONTYPE("2"); + hiddenEntity.setLONGITUDE(ryCheckJlEntity.getLongitude()); + hiddenEntity.setLATITUDE(ryCheckJlEntity.getLatitude()); + // 实际开始实际 是维修时间, + ryCheckJlEntity.getFstrdateSj(); + // 实际结束时间是 维修完成时间 + ryCheckJlEntity.getFenddateSj(); + // 整改期限-整改时间 + hiddenEntity.setRECTIFICATIONDEADLINE(ryCheckJlEntity.getFenddateSj()); + hiddenEntity.setRECTIFICATIONTIME(ryCheckJlEntity.getFenddateSj()); + // 隐患级别 默认为一般隐患 + hiddenEntity.setHIDDENLEVEL("hiddenLevel1002"); + // 隐患来源 souce -》 8 点检隐患 + hiddenEntity.setSOURCE("8"); + + // 派单模式(0 指派;1 抢单;2 技术员自修), 2 是本公司的人 0,1都是相关方的人。 + if (ryCheckJlEntity.getFpattern() == 2) { + hiddenEntity.setISRELEVANT("2"); + System.out.println("整改人是本公司的"); + } else { + System.out.println("整改人是相关方的"); + hiddenEntity.setISRELEVANT("1"); + if (!deptMap.containsKey(ryCheckJlEntity.getFwwdwStr())) { + // 新部门 一定是相关方的 相关方 为144 + PageData deptPageData = saveDept("14465464734a4845b6313118408e328e", ryCheckJlEntity.getFwwdwStr()); + deptMap.put(ryCheckJlEntity.getFwwdwStr(), deptPageData.getString("DEPARTMENT_ID")); + } + } + // 维修单位,维修人 对应隐患维修人 + ryCheckJlEntity.getFwwdwStr(); + ryCheckJlEntity.getFwxfzr(); + ryCheckJlEntity.getFwxfzrTel(); + + PageData RECTIFI_USER = getUserPdByTel(userMap, ryCheckJlEntity, 1); + System.out.println("整改人-》整改人有可能是本公司的" + "姓名" + ryCheckJlEntity.getFwxfzr() + ",电话:" + ryCheckJlEntity.getFwxfzrTel() + ",部门:" + ryCheckJlEntity.getFwwdwStr() + ",维修工艺:" + ryCheckJlEntity.getFwxgyName()); + hiddenEntity.setRECTIFICATIONOR(RECTIFI_USER.getString("USER_ID")); + + + // 签发人 + ryCheckJlEntity.getFqfuserStr(); + ryCheckJlEntity.getFqfuserPhone(); + ryCheckJlEntity.getFqfuserDeptStr(); + if (!deptMap.containsKey(ryCheckJlEntity.getFqfuserDeptStr())) { + // 新部门 一定是本单位的 + PageData deptPageData = saveDept("8854edee3aa94be496cee676b6d4845a", ryCheckJlEntity.getFqfuserDeptStr()); + deptMap.put(ryCheckJlEntity.getFqfuserDeptStr(), deptPageData.getString("DEPARTMENT_ID")); + } + // todo + System.out.println("发现人-》发现人是本公司的" + "姓名" + ryCheckJlEntity.getFqfuserStr() + ",电话:" + ryCheckJlEntity.getFqfuserPhone() + ",部门:" + ryCheckJlEntity.getFqfuserDeptStr()); + PageData CREATOR_USER = getUserPdByTel(userMap, ryCheckJlEntity, 2); + hiddenEntity.setCREATOR(CREATOR_USER.getString("USER_ID")); +// hiddenEntity.setCREATOR("5c61afed41bc4c25acf77aed1391e666"); + // 签发时间-》 对应隐患发现时间 + hiddenEntity.setCREATTIME(ryCheckJlEntity.getFqfdate()); + // 隐患确认人 + hiddenEntity.setCONFIRM_USER(CREATOR_USER.getString("USER_ID")); + hiddenEntity.setCONFIRM_TIME(ryCheckJlEntity.getFqfdate()); + hiddenEntity.setDISCOVERYTIME(ryCheckJlEntity.getFqfdate()); + + // 隐患类型 1 保养类;2 故障停机类;3 环保设施类) + if (ryCheckJlEntity.getFworkordertype() != null && ryCheckJlEntity.getFworkordertype() == 3) { + hiddenEntity.setHIDDENTYPE2("卫生环保"); + hiddenEntity.setHIDDENTYPE("wshb-qt"); + } else { + hiddenEntity.setHIDDENTYPE2("安全隐患"); + hiddenEntity.setHIDDENTYPE("aqyh-qt"); + } + + + // 问题描述对应 -》隐患描述 + ryCheckJlEntity.getZxNote(); + hiddenEntity.setHIDDENDESCR(ryCheckJlEntity.getZxNote()); + // 维修工艺附件(整改方案) 和 点检评价(隐患图片) 附件 + // 整改描述 + ryCheckJlEntity.getFwxgyName(); + hiddenEntity.setRECTIFYDESCR(ryCheckJlEntity.getFwxgyName()); + // 维修工艺附件 + ryCheckJlEntity.getFwxgyFilepath(); + + // 验收人 对应验收人 + ryCheckJlEntity.getYs_user(); + // 默认合格 + hiddenEntity.setISQUALIFIED("1"); + // 验收描述 + hiddenEntity.setCHECKDESCR(ryCheckJlEntity.getFys_note()); + // 验收人 +// hiddenEntity.setCHECKOR(ryCheckJlEntity.getYs_user()); + if (!deptMap.containsKey(ryCheckJlEntity.getFysDept())) { + // 新部门 一定是本单位的 + PageData deptPageData = saveDept("8854edee3aa94be496cee676b6d4845a", ryCheckJlEntity.getFysDept()); + deptMap.put(ryCheckJlEntity.getFqfuserDeptStr(), deptPageData.getString("DEPARTMENT_ID")); + } + + PageData CHECKOR_USER = getUserPdByTel(userMap, ryCheckJlEntity, 3); + hiddenEntity.setCHECKOR(CHECKOR_USER.getString("USER_ID")); + System.out.println("验收人-》验收人是本公司的" + "姓名" + ryCheckJlEntity.getYs_user() + ",电话:" + ryCheckJlEntity.getFysPhone() + ",部门:" + ryCheckJlEntity.getFysDept()); + // 验收时间 + hiddenEntity.setCHECKTIME(ryCheckJlEntity.getFys_date()); + hiddenList.add(hiddenEntity); + // 如果有隐患照片的话 保存起来 + if (ryCheckJlEntity.getFileList() != null) { + for (HashMap map : ryCheckJlEntity.getFileList()) { + // 获取文件路径 + String ffilepath = (String) map.get("ffilepath"); + // filename -> temp.jpg + InputStream netUrlHttps = HttpsFileDownload.getNetUrlHttpsStream(ffilepath, ""); + String ffile = DateUtil.getDays(); + String fileName = UuidUtil.get32UUID() + (String) map.get("filename"); + String filePath = Const.FILEPATHYHTP + "8854edee3aa94be496cee676b6d4845a" + "/" + ffile + "/"; + // 获取流文件 上传到 附件服务器 +// InputStream fileI = Smb.sshSftpForInput(new FileInputStream(ffilepath), ffilepath, ""); + // bus_imgfiles -> FOREIGN_KEY -> hiddenId ||| TYPE ->3 + try { + Smb.sshSftpForInput(netUrlHttps, fileName, filePath); + ImgFilesEntity imgFilesEntity = new ImgFilesEntity(); + imgFilesEntity.setIMGFILES_ID(UuidUtil.get32UUID()); + imgFilesEntity.setFILEPATH(filePath + fileName); + imgFilesEntity.setFOREIGN_KEY(hiddenEntity.getHIDDEN_ID()); + imgFilesEntity.setTYPE("3"); + imgfilesMapper.insert(imgFilesEntity); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + hiddenUserList.add(new HiddenUserEntity(UuidUtil.get32UUID(), hiddenEntity.getHIDDEN_ID(), hiddenEntity.getCREATOR(), "1", "0")); + hiddenCheckUserList.add(new HiddenCheckUserEntity(UuidUtil.get32UUID(), hiddenEntity.getHIDDEN_ID(), deptMap.get(ryCheckJlEntity.getFysDept()), userMap.get(ryCheckJlEntity.getFysPhone()).getString("USER_ID"), "0", ryCheckJlEntity.getFys_date(), ryCheckJlEntity.getFys_note())); + } + } + if (!hiddenList.isEmpty()) { + hiddenService.saveBatch(hiddenList); + hiddenUserService.saveBatch(hiddenUserList); + hiddenCheckUserService.saveBatch(hiddenCheckUserList); + // bus_hidden_user 隐患发现人存入这里 + //BUS_HIDDENCHECK 隐患验收人存入这里 + } + return hiddenList; + } + + private PageData saveDept(String PARENT_ID, String fwwdwStr) { + PageData deptPageData = new PageData(); + deptPageData.put("DEPARTMENT_ID", UuidUtil.get32UUID()); + deptPageData.put("NAME", fwwdwStr); + deptPageData.put("PARENT_ID", PARENT_ID); + deptPageData.put("CORPINFO_ID", "8854edee3aa94be496cee676b6d4845a"); + deptPageData.put("LEVEL", "departmentLevel0003"); + deptPageData.put("DEP_ORDER", "1"); + deptPageData.put("ISSUPERVISE", "0"); + userMapper.addDept(deptPageData); + return deptPageData; + } + + private PageData getUserPdByTel(HashMap userMap, RyCheckJlEntity ryCheckJlEntity, int type) { + PageData pageData = null; + // 整改人 + if (type == 1) { + pageData = userMap.get(ryCheckJlEntity.getFwxfzrTel()); + } + // 发现人 + if (type == 2) { + pageData = userMap.get(ryCheckJlEntity.getFqfuserPhone()); + } + // 验收人 + if (type == 3) { + pageData = userMap.get(ryCheckJlEntity.getFysPhone()); + } + if (pageData == null) { + // 本系统不存在这个人。 新增 这个人、部门。然后同步给秦港。 + PageData userPd = saveUser(ryCheckJlEntity, type); + if (type == 1) { + userMap.put(ryCheckJlEntity.getFwxfzrTel(), userPd); + } + if (type == 2) { + userMap.put(ryCheckJlEntity.getFqfuserPhone(), userPd); + } + if (type == 3) { + userMap.put(ryCheckJlEntity.getFysPhone(), userPd); + } + return userPd; + } + return pageData; + } + + private PageData saveUser(RyCheckJlEntity ryCheckJlEntity, int type) { + // 整改人 (大概率相关方) + PageData pageData = new PageData(); + String password = ""; + pageData.put("USER_ID", UuidUtil.get32UUID()); + pageData.put("IS_HAZARDCONFIRMER", "1"); + + // 整改 + if (type == 1) { + pageData.put("USERNAME", ryCheckJlEntity.getFwxfzrTel()); + pageData.put("NAME", ryCheckJlEntity.getFwxfzr()); + pageData.put("IS_HAZARDCONFIRMER", "0"); + pageData.put("DEPARTMENT_ID", deptMap.get(ryCheckJlEntity.getFwwdwStr())); + password = new SimpleHash("SHA-1", ryCheckJlEntity.getFwxfzrTel(), "Aa@602209238").toString(); + } + // 发现人 + if (type == 2) { + pageData.put("USERNAME", ryCheckJlEntity.getFqfuserPhone()); + pageData.put("NAME", ryCheckJlEntity.getFqfuserStr()); + pageData.put("DEPARTMENT_ID", deptMap.get(ryCheckJlEntity.getFqfuserDeptStr())); + password = new SimpleHash("SHA-1", ryCheckJlEntity.getFqfuserPhone(), "Aa@602209238").toString(); + + } + // 验收 + if (type == 3) { + pageData.put("USERNAME", ryCheckJlEntity.getFysPhone()); + pageData.put("NAME", ryCheckJlEntity.getYs_user()); + pageData.put("DEPARTMENT_ID", deptMap.get(ryCheckJlEntity.getFysDept())); + password = new SimpleHash("SHA-1", ryCheckJlEntity.getFysPhone(), "Aa@602209238").toString(); + } + pageData.put("ROLE_ID", "96036bcce5cf418baf8bc2f91271c8c6"); + pageData.put("PASSWORD", password); + pageData.put("STATUS", "0"); + pageData.put("SKIN", "pcoded-navbar navbar-image-3,navbar pcoded-header navbar-expand-lg navbar-light header-dark,"); + pageData.put("CORPINFO_ID", "8854edee3aa94be496cee676b6d4845a"); + pageData.put("ISMAIN", "0"); + pageData.put("ISDELETE", "0"); + pageData.put("PERSON_TYPE", "其他"); + userMapper.saveUser(pageData); + System.out.println("新增用户" + pageData.toString()); + return pageData; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void getRyCheckJhList() { + ReturnMap httpResponseStr = HttpRequestUtilCheck.doPost("http://192.168.210.123:7016/jt_equipment/jt/getDjjhData"); + httpResponseStr.get("list"); + JSONArray dataList = (JSONArray) httpResponseStr.get("list"); + List ryCheckJlEntities = JSON.parseArray(dataList.toJSONString(), RyCheckJhEntity.class); + ryCheckJhService.saveBatch(ryCheckJlEntities); + } + + @Override + public void getRyCheckRyMbList() { + ryCheckMbService.remove(new QueryWrapper<>()); + ReturnMap httpResponseStr = HttpRequestUtilCheck.doPost("http://192.168.210.123:7016/jt_equipment/jt/getModelPlanData"); + httpResponseStr.get("list"); + JSONArray dataList = (JSONArray) httpResponseStr.get("list"); + List ryCheckJlEntities = JSON.parseArray(dataList.toJSONString(), RyCheckMbEntity.class); + ryCheckMbService.saveBatch(ryCheckJlEntities); + } + + @Override + public void pushedHiddenList() { + QueryWrapper hiddenEntityQueryWrapper = new QueryWrapper<>(); + hiddenEntityQueryWrapper.eq("SOURCE", "8"); + hiddenEntityQueryWrapper.eq("ISDELETE", "0"); + hiddenEntityQueryWrapper.notIn("HIDDEN_ID", new ArrayList<>()); +// hiddenService.listAnd + List list = hiddenService.list(hiddenEntityQueryWrapper); + // 推送数据到港股。 + // hiddenInfoList + // userInfoList + + + } + + @Override + public void getAllUser() { + List allUserList = userMapper.getAllUsers(new PageData()); + + } + + @Override + public void getAllDept() { + List allDeptList = userMapper.getAllDepts(new PageData()); + + } + + @Override + public void getAllHidden(PageData pd) { + List hiddenList = hiddenService.getAllUserList(pd); + String fileUrl = Const.FILE_URL; + for (PageData pageData : hiddenList) { + PageData imgPd = new PageData(); + imgPd.put("FOREIGN_KEY",pageData.getString("HIDDEN_ID")); + imgPd.put("fileUrl",fileUrl); + List imgList= imgfilesMapper.getAllImgList(imgPd); + pageData.put("FileList",imgList); + } + } + + + + public static void main(String[] args) throws Exception { +// InputStream 转 + // ffilepath -> http://192.168.210.76/uploads//1729600183218.jpg + InputStream netUrlHttps = HttpsFileDownload.getNetUrlHttpsStream("http://192.168.210.76/uploads//1729600183218.jpg", ""); + // + System.out.println(netUrlHttps); + + Smb.sshSftpForInput(netUrlHttps, "", ""); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/alarmInfo/controller/AlarmInfoController.java b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/controller/AlarmInfoController.java new file mode 100644 index 0000000..c95fadc --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/controller/AlarmInfoController.java @@ -0,0 +1 @@ +package com.zcloud.modules.alarmInfo.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/alarmInfo/entity/AlarmInfoEntity.java b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/entity/AlarmInfoEntity.java new file mode 100644 index 0000000..b1991d2 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/entity/AlarmInfoEntity.java @@ -0,0 +1,96 @@ +package com.zcloud.modules.alarmInfo.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.Date; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("bus_alarm_info") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class AlarmInfoEntity { + /** + * + */ + @TableId(value = "ALARM_INFO_ID",type = IdType.AUTO) + @TableField(value = "ALARM_INFO_ID") + @JsonProperty(value = "ALARM_INFO_ID") + private String alarmInfoId; + /** + * 报警值 + */ + @TableField(value = "ALARM_VALUE") + @JsonProperty(value = "ALARM_VALUE") + private String alarmValue; + /** + * 报警时间 + */ + @TableField(value = "ALARM_TIME") + @JsonProperty(value = "ALARM_TIME") + private String alarmTime; + /** + * 报警等级 + */ + @TableField(value = "LEVEL") + @JsonProperty(value = "LEVEL") + private String LEVEL; + /** + * 添加人 + */ + @TableField(value = "CREATOR") + @JsonProperty(value = "CREATOR") + private String CREATOR; + /** + * 添加时间 + */ + @TableField(value = "CREATTIME") + @JsonProperty(value = "CREATTIME") + private String CREATTIME; + /** + * 修改人 + */ + @TableField(value = "OPERATOR") + @JsonProperty(value = "OPERATOR") + private String OPERATOR; + /** + * 修改时间 + */ + @TableField(value = "OPERATTIME") + @JsonProperty(value = "OPERATTIME") + private String OPERATTIME; + /** + * 是否删除0用1删 + */ + @TableField(value = "ISDELETE") + @JsonProperty(value = "ISDELETE") + private String ISDELETE; + /** + * 设备id + */ + @TableField(value = "ANEMOMETER_ID") + @JsonProperty(value = "ANEMOMETER_ID") + private String anemometerId; + /** + * 报警信息 + */ + @TableField(value = "LOG") + @JsonProperty(value = "LOG") + private String LOG; + + /** + * 企业id + */ + @TableField(value = "CORPINFO_ID") + @JsonProperty(value = "CORPINFO_ID") + private String corpinfoId; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/alarmInfo/mapper/AlarmInfoMapper.java b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/mapper/AlarmInfoMapper.java new file mode 100644 index 0000000..3c75c3e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/mapper/AlarmInfoMapper.java @@ -0,0 +1,20 @@ +package com.zcloud.modules.alarmInfo.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.alarmInfo.entity.AlarmInfoEntity; +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface AlarmInfoMapper extends BaseMapper { + + List findThreshold(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/alarmInfo/service/AlarmInfoService.java b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/service/AlarmInfoService.java new file mode 100644 index 0000000..160049a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/service/AlarmInfoService.java @@ -0,0 +1,18 @@ +package com.zcloud.modules.alarmInfo.service; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.alarmInfo.entity.AlarmInfoEntity; +import com.zcloud.modules.sys.entity.PageData; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface AlarmInfoService extends IService { + + List findThreshold(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/alarmInfo/service/impl/AlarmInfoServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/service/impl/AlarmInfoServiceImpl.java new file mode 100644 index 0000000..ad537e9 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/alarmInfo/service/impl/AlarmInfoServiceImpl.java @@ -0,0 +1,28 @@ +package com.zcloud.modules.alarmInfo.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.alarmInfo.entity.AlarmInfoEntity; +import com.zcloud.modules.alarmInfo.mapper.AlarmInfoMapper; +import com.zcloud.modules.alarmInfo.service.AlarmInfoService; +import com.zcloud.modules.sys.entity.PageData; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class AlarmInfoServiceImpl extends ServiceImpl implements AlarmInfoService { + + @Override + public List findThreshold(PageData pd) { + List threshold = baseMapper.findThreshold(pd); + return threshold; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/controller/AnemometerMachineController.java b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/controller/AnemometerMachineController.java new file mode 100644 index 0000000..80e04fe --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/controller/AnemometerMachineController.java @@ -0,0 +1 @@ +package com.zcloud.modules.anemometerMachine.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/entity/AnemometerMachineEntity.java b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/entity/AnemometerMachineEntity.java new file mode 100644 index 0000000..a3422d8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/entity/AnemometerMachineEntity.java @@ -0,0 +1,76 @@ +package com.zcloud.modules.anemometerMachine.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("bus_anemometer_machine") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class AnemometerMachineEntity { + /** + * 风速仪ID + */ + @TableId(value = "ANEMOMETER_ID",type = IdType.AUTO) + // @TableField(value = "ANEMOMETER_ID") + @JsonProperty(value = "ANEMOMETER_ID") + private String anemometerId; + /** + * 风速仪名称 + */ + // @TableField(value = "ANEMOMETER_NAME") + @JsonProperty(value = "ANEMOMETER_NAME") + private String anemometerName; + /** + * 经度 + */ + @TableField(value = "LONGITUDE") + @JsonProperty(value = "LONGITUDE") + private String LONGITUDE; + /** + * 纬度 + */ + @TableField(value = "LATITUDE") + @JsonProperty(value = "LATITUDE") + private String LATITUDE; + /** + * 创建人 + */ + @TableField(value = "CREATOR") + @JsonProperty(value = "CREATOR") + private String CREATOR; + /** + * 创建时间 + */ + @TableField(value = "CREATTIME") + @JsonProperty(value = "CREATTIME") + private String CREATTIME; + /** + * 修改人 + */ + @TableField(value = "OPERATOR") + @JsonProperty(value = "OPERATOR") + private String OPERATOR; + /** + * 修改时间 + */ + @TableField(value = "OPERATTIME") + @JsonProperty(value = "OPERATTIME") + private String OPERATTIME; + + /** + * 企业id + */ + @TableField(value = "CORPINFO_ID") + @JsonProperty(value = "CORPINFO_ID") + private String corpinfoId; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/mapper/AnemometerMachineMapper.java b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/mapper/AnemometerMachineMapper.java new file mode 100644 index 0000000..6fac702 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/mapper/AnemometerMachineMapper.java @@ -0,0 +1,19 @@ +package com.zcloud.modules.anemometerMachine.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.anemometerMachine.entity.AnemometerMachineEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface AnemometerMachineMapper extends BaseMapper { + + @Select("SELECT ANEMOMETER_ID, ANEMOMETER_NAME FROM bus_anemometer_machine WHERE ANEMOMETER_ID ='39fe35ddcf3c4c1b82651927982cef20'") + AnemometerMachineEntity selectByCustomQuery(); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/service/AnemometerMachineService.java b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/service/AnemometerMachineService.java new file mode 100644 index 0000000..7560ed2 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/service/AnemometerMachineService.java @@ -0,0 +1,14 @@ +package com.zcloud.modules.anemometerMachine.service; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.anemometerMachine.entity.AnemometerMachineEntity; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface AnemometerMachineService extends IService { + + AnemometerMachineEntity selectByCustomQuery(); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/service/impl/AnemometerMachineServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/service/impl/AnemometerMachineServiceImpl.java new file mode 100644 index 0000000..6e130d4 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerMachine/service/impl/AnemometerMachineServiceImpl.java @@ -0,0 +1,24 @@ +package com.zcloud.modules.anemometerMachine.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.anemometerMachine.entity.AnemometerMachineEntity; +import com.zcloud.modules.anemometerMachine.mapper.AnemometerMachineMapper; +import com.zcloud.modules.anemometerMachine.service.AnemometerMachineService; +import org.springframework.stereotype.Service; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class AnemometerMachineServiceImpl extends ServiceImpl implements AnemometerMachineService { + + + @Override + public AnemometerMachineEntity selectByCustomQuery() { + return baseMapper.selectByCustomQuery(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/controller/AnemometerRecordController.java b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/controller/AnemometerRecordController.java new file mode 100644 index 0000000..68e5a88 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/controller/AnemometerRecordController.java @@ -0,0 +1 @@ +package com.zcloud.modules.anemometerRecord.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/entity/AnemometerRecordEntity.java b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/entity/AnemometerRecordEntity.java new file mode 100644 index 0000000..07e594a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/entity/AnemometerRecordEntity.java @@ -0,0 +1,80 @@ +package com.zcloud.modules.anemometerRecord.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.Date; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("bus_anemometer_record") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class AnemometerRecordEntity { + /** + * 风速数据ID + */ + @TableId(value = "ANEMOMETER_RECIRD_ID",type = IdType.AUTO) + @JsonProperty(value = "ANEMOMETER_RECIRD_ID") + private String anemometerRecordId; + /** + * 风速仪ID + */ + @JsonProperty(value = "ANEMOMETER_ID") + private String anemometerId; + /** + * 风速值 + */ + @TableField(value = "VALUE") + @JsonProperty(value = "VALUE") + private String VALUE; + /** + * 数据时间 + */ + @TableField(value = "DATE") + @JsonProperty(value = "DATE") + private String DATE; + /** + * 创建人 + */ + @TableField(value = "CREATOR") + @JsonProperty(value = "CREATOR") + private String CREATOR; + /** + * 创建时间 + */ + @TableField(value = "CREATTIME") + @JsonProperty(value = "CREATTIME") + private String CREATTIME; + /** + * 修改人 + */ + @TableField(value = "OPERATOR") + @JsonProperty(value = "OPERATOR") + private String OPERATOR; + /** + * 修改时间 + */ + @TableField(value = "OPERATTIME") + @JsonProperty(value = "OPERATTIME") + private String OPERATTIME; + + /** + * 企业id + */ + @TableField(value = "CORPINFO_ID") + @JsonProperty(value = "CORPINFO_ID") + private String corpinfoId; + + @TableField(exist = false) + @JsonProperty(value = "ANEMOMETER_NAME") + private String anemometerName; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/mapper/AnemometerRecordMapper.java b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/mapper/AnemometerRecordMapper.java new file mode 100644 index 0000000..5a91ac8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/mapper/AnemometerRecordMapper.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.anemometerRecord.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.anemometerRecord.entity.AnemometerRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface AnemometerRecordMapper extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/service/AnemometerRecordService.java b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/service/AnemometerRecordService.java new file mode 100644 index 0000000..b293bc1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/service/AnemometerRecordService.java @@ -0,0 +1,17 @@ +package com.zcloud.modules.anemometerRecord.service; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.anemometerRecord.entity.AnemometerRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface AnemometerRecordService extends IService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/service/impl/AnemometerRecordServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/service/impl/AnemometerRecordServiceImpl.java new file mode 100644 index 0000000..9aaaec2 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/anemometerRecord/service/impl/AnemometerRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.zcloud.modules.anemometerRecord.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.anemometerRecord.entity.AnemometerRecordEntity; +import com.zcloud.modules.anemometerRecord.mapper.AnemometerRecordMapper; +import com.zcloud.modules.anemometerRecord.service.AnemometerRecordService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class AnemometerRecordServiceImpl extends ServiceImpl implements AnemometerRecordService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/annotation/Login.java b/review_repo/src/main/java/com/zcloud/modules/app/annotation/Login.java new file mode 100644 index 0000000..ac7e4b6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/annotation/Login.java @@ -0,0 +1,14 @@ +package com.zcloud.modules.app.annotation; + +import java.lang.annotation.*; + +/** + * app登录效验 + * + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Login { +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/annotation/LoginUser.java b/review_repo/src/main/java/com/zcloud/modules/app/annotation/LoginUser.java new file mode 100644 index 0000000..76e32a3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/annotation/LoginUser.java @@ -0,0 +1,19 @@ + + +package com.zcloud.modules.app.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 登录用户信息 + * + * + */ +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +public @interface LoginUser { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/config/WebMvcConfig.java b/review_repo/src/main/java/com/zcloud/modules/app/config/WebMvcConfig.java new file mode 100644 index 0000000..226a47b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/config/WebMvcConfig.java @@ -0,0 +1,39 @@ + + +package com.zcloud.modules.app.config; + +import com.zcloud.modules.app.interceptor.AuthorizationInterceptor; +import com.zcloud.modules.app.resolver.LoginUserHandlerMethodArgumentResolver; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +/** + * MVC配置 + * + * + */ +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + @Autowired + private AuthorizationInterceptor authorizationInterceptor; + @Autowired + private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(authorizationInterceptor) + .addPathPatterns("/app/**") + .addPathPatterns("/busVisitor/**") + .addPathPatterns("/busStudyTask/downExamExcel"); + } + + @Override + public void addArgumentResolvers(List argumentResolvers) { + argumentResolvers.add(loginUserHandlerMethodArgumentResolver); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/controller/AppLoginController.java b/review_repo/src/main/java/com/zcloud/modules/app/controller/AppLoginController.java new file mode 100644 index 0000000..940c76f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/controller/AppLoginController.java @@ -0,0 +1,57 @@ + + +package com.zcloud.modules.app.controller; + + +import com.zcloud.common.utils.R; +import com.zcloud.common.validator.ValidatorUtils; +import com.zcloud.modules.app.form.LoginForm; +import com.zcloud.modules.app.service.UserService; +import com.zcloud.modules.app.utils.JwtUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import java.util.HashMap; +import java.util.Map; + +/** + * APP登录授权 + * + */ +@RestController +//@RequestMapping("/app") +//@Api(tags="APP登录接口") +public class AppLoginController { + @Autowired + private UserService userService; + @Autowired + private JwtUtils jwtUtils; + + /** + * 登录 + */ + @PostMapping("login") +// @ApiOperation("登录") + public R login(@RequestBody LoginForm form){ + //表单校验 + ValidatorUtils.validateEntity(form); + + //用户登录 + String userId = userService.login(form); + + //生成token + String token = jwtUtils.generateToken(userId); + + Map map = new HashMap<>(); + map.put("token", token); + map.put("expire", jwtUtils.getExpire()); + + return R.ok(map); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/dao/UserDao.java b/review_repo/src/main/java/com/zcloud/modules/app/dao/UserDao.java new file mode 100644 index 0000000..f95141c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/dao/UserDao.java @@ -0,0 +1,17 @@ + + +package com.zcloud.modules.app.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.app.entity.UserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户 + * + * + */ +@Mapper +public interface UserDao extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/entity/UserEntity.java b/review_repo/src/main/java/com/zcloud/modules/app/entity/UserEntity.java new file mode 100644 index 0000000..9203552 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/entity/UserEntity.java @@ -0,0 +1,45 @@ + + +package com.zcloud.modules.app.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 用户 + * + * + */ +@Data +@TableName("tb_user") +public class UserEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + @TableId + private String userId; + /** + * 用户名 + */ + private String username; + /** + * 手机号 + */ + private String mobile; + /** + * 密码 + */ + private String password; + /** + * 创建时间 + */ + private Date createTime; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/form/LoginForm.java b/review_repo/src/main/java/com/zcloud/modules/app/form/LoginForm.java new file mode 100644 index 0000000..944d5f3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/form/LoginForm.java @@ -0,0 +1,33 @@ + + +package com.zcloud.modules.app.form; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 登录表单 + * + */ +@Data +@ApiModel(value = "登录表单") +public class LoginForm { + @ApiModelProperty(value = "用户名") + @NotBlank(message="用户名不能为空") + private String username; + + @ApiModelProperty(value = "密码") + @NotBlank(message="密码不能为空") + private String password; + + @ApiModelProperty(value = "验证码") + @NotBlank(message="验证码不能为空") + private String verifyCode; + + @ApiModelProperty(value = "验证码code") + private String codeNum; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/form/RegisterForm.java b/review_repo/src/main/java/com/zcloud/modules/app/form/RegisterForm.java new file mode 100644 index 0000000..3c51936 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/form/RegisterForm.java @@ -0,0 +1,27 @@ + + +package com.zcloud.modules.app.form; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 注册表单 + * + * + */ +@Data +@ApiModel(value = "注册表单") +public class RegisterForm { + @ApiModelProperty(value = "手机号") + @NotBlank(message="手机号不能为空") + private String mobile; + + @ApiModelProperty(value = "密码") + @NotBlank(message="密码不能为空") + private String password; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/interceptor/AuthorizationInterceptor.java b/review_repo/src/main/java/com/zcloud/modules/app/interceptor/AuthorizationInterceptor.java new file mode 100644 index 0000000..aebd6f1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/interceptor/AuthorizationInterceptor.java @@ -0,0 +1,65 @@ + + +package com.zcloud.modules.app.interceptor; + + +import com.zcloud.common.exception.ZException; +import com.zcloud.modules.app.annotation.Login; +import com.zcloud.modules.app.utils.JwtUtils; +import io.jsonwebtoken.Claims; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 权限(Token)验证 + * + */ +@Component +public class AuthorizationInterceptor extends HandlerInterceptorAdapter { + @Autowired + private JwtUtils jwtUtils; + + public static final String USER_KEY = "userId"; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + Login annotation; + if(handler instanceof HandlerMethod) { + annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class); + }else{ + return true; + } + + if(annotation == null){ + return true; + } + + //获取用户凭证 + String token = request.getHeader(jwtUtils.getHeader()); + if(StringUtils.isBlank(token)){ + token = request.getParameter(jwtUtils.getHeader()); + } + + //凭证为空 + if(StringUtils.isBlank(token)){ + throw new ZException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value()); + } + + Claims claims = jwtUtils.getClaimByToken(token); + if(claims == null || jwtUtils.isTokenExpired(claims.getExpiration())){ + throw new ZException(jwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value()); + } + + //设置userId到request里,后续根据userId,获取用户信息 + request.setAttribute(USER_KEY, Long.parseLong(claims.getSubject())); + + return true; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java b/review_repo/src/main/java/com/zcloud/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java new file mode 100644 index 0000000..f4d32a9 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java @@ -0,0 +1,44 @@ +package com.zcloud.modules.app.resolver; + +import com.zcloud.modules.app.annotation.LoginUser; +import com.zcloud.modules.app.entity.UserEntity; +import com.zcloud.modules.app.interceptor.AuthorizationInterceptor; +import com.zcloud.modules.app.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.MethodParameter; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; + +/** + * 有@LoginUser注解的方法参数,注入当前登录用户 + * + */ +@Component +public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { + @Autowired + private UserService userService; + + @Override + public boolean supportsParameter(MethodParameter parameter) { + return parameter.getParameterType().isAssignableFrom(UserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class); + } + + @Override + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container, + NativeWebRequest request, WebDataBinderFactory factory) throws Exception { + //获取用户ID + Object object = request.getAttribute(AuthorizationInterceptor.USER_KEY, RequestAttributes.SCOPE_REQUEST); + if(object == null){ + return null; + } + + //获取用户信息 + UserEntity user = userService.getById((String)object); + + return user; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/service/UserService.java b/review_repo/src/main/java/com/zcloud/modules/app/service/UserService.java new file mode 100644 index 0000000..9b3b3c0 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/service/UserService.java @@ -0,0 +1,26 @@ + + +package com.zcloud.modules.app.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.app.entity.UserEntity; +import com.zcloud.modules.app.form.LoginForm; + +/** + * 用户 + * + * + */ +public interface UserService extends IService { + + UserEntity queryByMobile(String mobile); + + /** + * 用户登录 + * + * @param form 登录表单 + * @return 返回用户ID + */ + String login(LoginForm form); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/service/impl/UserServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/app/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..0a7e768 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/service/impl/UserServiceImpl.java @@ -0,0 +1,35 @@ +package com.zcloud.modules.app.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.exception.ZException; +import com.zcloud.common.validator.Assert; +import com.zcloud.modules.app.dao.UserDao; +import com.zcloud.modules.app.entity.UserEntity; +import com.zcloud.modules.app.form.LoginForm; +import com.zcloud.modules.app.service.UserService; +import org.apache.commons.codec.digest.DigestUtils; +import org.springframework.stereotype.Service; + + +@Service("userService") +public class UserServiceImpl extends ServiceImpl implements UserService { + + @Override + public UserEntity queryByMobile(String mobile) { + return baseMapper.selectOne(new QueryWrapper().eq("mobile", mobile)); + } + + @Override + public String login(LoginForm form) { + UserEntity user = queryByMobile(form.getUsername()); + Assert.isNull(user, "手机号或密码错误"); + + //密码错误 + if(!user.getPassword().equals(DigestUtils.sha256Hex(form.getPassword()))){ + throw new ZException("手机号或密码错误"); + } + + return user.getUserId(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/app/utils/JwtUtils.java b/review_repo/src/main/java/com/zcloud/modules/app/utils/JwtUtils.java new file mode 100644 index 0000000..a0591be --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/app/utils/JwtUtils.java @@ -0,0 +1,87 @@ +package com.zcloud.modules.app.utils; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * jwt工具类 + * + * + */ +@ConfigurationProperties(prefix = "spring.jwt") +@Component +public class JwtUtils { + private Logger logger = LoggerFactory.getLogger(getClass()); + + private String secret; + private long expire; + private String header; + + /** + * 生成jwt token + */ + public String generateToken(String userId) { + Date nowDate = new Date(); + //过期时间 + Date expireDate = new Date(nowDate.getTime() + expire * 1000); + + return Jwts.builder() + .setHeaderParam("typ", "JWT") + .setSubject(userId+"") + .setIssuedAt(nowDate) + .setExpiration(expireDate) + .signWith(SignatureAlgorithm.HS512, secret) + .compact(); + } + + public Claims getClaimByToken(String token) { + try { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + }catch (Exception e){ + logger.debug("validate is token error ", e); + return null; + } + } + + /** + * token是否过期 + * @return true:过期 + */ + public boolean isTokenExpired(Date expiration) { + return expiration.before(new Date()); + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public long getExpire() { + return expire; + } + + public void setExpire(long expire) { + this.expire = expire; + } + + public String getHeader() { + return header; + } + + public void setHeader(String header) { + this.header = header; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djCarLog/controller/DjCarLogController.java b/review_repo/src/main/java/com/zcloud/modules/djCarLog/controller/DjCarLogController.java new file mode 100644 index 0000000..bea6460 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djCarLog/controller/DjCarLogController.java @@ -0,0 +1 @@ +package com.zcloud.modules.djCarLog.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/djCarLog/entity/DjCarLogEntity.java b/review_repo/src/main/java/com/zcloud/modules/djCarLog/entity/DjCarLogEntity.java new file mode 100644 index 0000000..2faa225 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djCarLog/entity/DjCarLogEntity.java @@ -0,0 +1,104 @@ +package com.zcloud.modules.djCarLog.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("dj_car_log") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class DjCarLogEntity { + /** + * 车辆进出日志id + */ + @TableId(value = "car_log_id",type = IdType.AUTO) + @JsonProperty(value = "car_log_id") + private String carLogId; + /** + * 车辆类型: 101 疏港车辆,1 注册客车,3 货车,5 场内流动机械,7 倒运车,4 小货车 + */ + @TableField(value = "cartype") + @JsonProperty(value = "cartype") + private Integer cartype; + /** + * 进出状态(0 进入 1 离开) + */ + @TableField(value = "entrystatus") + @JsonProperty(value = "entrystatus") + private Integer entrystatus; + /** + * 操作状态 + */ + @TableField(value = "opstatusStr") + @JsonProperty(value = "opstatusStr") + private String opstatusStr; + /** + * 进出状态字符串 + */ + @TableField(value = "entrystatusStr") + @JsonProperty(value = "entrystatusStr") + private String entrystatusStr; + /** + * 操作状态(0 自动通行 1 手动通行) + */ + @TableField(value = "opstatus") + @JsonProperty(value = "opstatus") + private Integer opstatus; + /** + * 门禁id + */ + @TableField(value = "accId") + @JsonProperty(value = "accId") + private Integer accId; + /** + * 车牌 + */ + @TableField(value = "carsign") + @JsonProperty(value = "carsign") + private String carsign; + /** + * 部门id(对接过来的,本系统不使用) + */ + @TableField(value = "id") + @JsonProperty(value = "id") + private String id; + /** + * 进出位置 + */ + @TableField(value = "bayonetname") + @JsonProperty(value = "bayonetname") + private String bayonetname; + /** + * 进出时间 + */ + @TableField(value = "chtime") + @JsonProperty(value = "chtime") + private String chtime; + /** + * 车辆类型 + */ + @TableField(value = "typename") + @JsonProperty(value = "typename") + private String typename; + /** + * 门禁名称 + */ + @TableField(value = "accessname") + @JsonProperty(value = "accessname") + private String accessname; + + @JsonProperty(value = "CORPINFO_ID") + private String corpinfoId; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djCarLog/mapper/DjCarLogMapper.java b/review_repo/src/main/java/com/zcloud/modules/djCarLog/mapper/DjCarLogMapper.java new file mode 100644 index 0000000..7c3059e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djCarLog/mapper/DjCarLogMapper.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.djCarLog.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.djCarLog.entity.DjCarLogEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface DjCarLogMapper extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djCarLog/service/DjCarLogService.java b/review_repo/src/main/java/com/zcloud/modules/djCarLog/service/DjCarLogService.java new file mode 100644 index 0000000..1b0a365 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djCarLog/service/DjCarLogService.java @@ -0,0 +1,15 @@ +package com.zcloud.modules.djCarLog.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.djCarLog.entity.DjCarLogEntity; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface DjCarLogService extends IService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djCarLog/service/impl/DjCarLogServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/djCarLog/service/impl/DjCarLogServiceImpl.java new file mode 100644 index 0000000..120df01 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djCarLog/service/impl/DjCarLogServiceImpl.java @@ -0,0 +1,21 @@ +package com.zcloud.modules.djCarLog.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.djCarLog.entity.DjCarLogEntity; +import com.zcloud.modules.djCarLog.mapper.DjCarLogMapper; +import com.zcloud.modules.djCarLog.service.DjCarLogService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.Date; +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class DjCarLogServiceImpl extends ServiceImpl implements DjCarLogService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djPersonLog/controller/DjPersonLogController.java b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/controller/DjPersonLogController.java new file mode 100644 index 0000000..f7cb285 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/controller/DjPersonLogController.java @@ -0,0 +1 @@ +package com.zcloud.modules.djPersonLog.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/djPersonLog/entity/DjPersonLogEntity.java b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/entity/DjPersonLogEntity.java new file mode 100644 index 0000000..c0490a6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/entity/DjPersonLogEntity.java @@ -0,0 +1,86 @@ +package com.zcloud.modules.djPersonLog.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("dj_person_log") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class DjPersonLogEntity { + /** + * 人员进出日志id + */ + @TableId(value = "person_log_id",type = IdType.AUTO) + @JsonProperty(value = "person_log_id") + private String personLogId; + /** + * 进出状态(0 进入 1 离开) + */ + @TableField(value = "entrystatus") + @JsonProperty(value = "entrystatus") + private Integer entrystatus; + /** + * 操作状态 + */ + @TableField(value = "opstatusStr") + @JsonProperty(value = "opstatusStr") + private String opstatusStr; + /** + * 进出状态字符串 + */ + @TableField(value = "entrystatusStr") + @JsonProperty(value = "entrystatusStr") + private String entrystatusStr; + /** + * 工号 + */ + @TableField(value = "empNo") + @JsonProperty(value = "empNo") + private Integer empNo; + /** + * 门禁id + */ + @TableField(value = "accId") + @JsonProperty(value = "accId") + private Integer accId; + /** + * 人员姓名 + */ + @TableField(value = "username") + @JsonProperty(value = "username") + private String username; + /** + * 进出位置 + */ + @TableField(value = "bayonetname") + @JsonProperty(value = "bayonetname") + private String bayonetname; + /** + * 进出时间 + */ + @TableField(value = "chtime") + @JsonProperty(value = "chtime") + private String chtime; + /** + * 门禁名称 + */ + @TableField(value = "accessname") + @JsonProperty(value = "accessname") + private String accessname; + + @JsonProperty(value = "CORPINFO_ID") + private String corpinfoId; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djPersonLog/mapper/DjPersonLogMapper.java b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/mapper/DjPersonLogMapper.java new file mode 100644 index 0000000..743e006 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/mapper/DjPersonLogMapper.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.djPersonLog.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.djPersonLog.entity.DjPersonLogEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface DjPersonLogMapper extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djPersonLog/service/DjPersonLogService.java b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/service/DjPersonLogService.java new file mode 100644 index 0000000..8d04df3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/service/DjPersonLogService.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.djPersonLog.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.djPersonLog.entity.DjPersonLogEntity; + + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface DjPersonLogService extends IService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/djPersonLog/service/impl/DjPersonLogServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/service/impl/DjPersonLogServiceImpl.java new file mode 100644 index 0000000..2c34fb8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/djPersonLog/service/impl/DjPersonLogServiceImpl.java @@ -0,0 +1,22 @@ +package com.zcloud.modules.djPersonLog.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.djPersonLog.entity.DjPersonLogEntity; +import com.zcloud.modules.djPersonLog.mapper.DjPersonLogMapper; +import com.zcloud.modules.djPersonLog.service.DjPersonLogService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.Date; +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class DjPersonLogServiceImpl extends ServiceImpl implements DjPersonLogService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/config/ScheduleConfig.java b/review_repo/src/main/java/com/zcloud/modules/job/config/ScheduleConfig.java new file mode 100644 index 0000000..a43d96a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/config/ScheduleConfig.java @@ -0,0 +1,53 @@ +package com.zcloud.modules.job.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; + +import javax.sql.DataSource; +import java.util.Properties; + +/** + * 定时任务配置 + * + */ +//@Configuration +public class ScheduleConfig { + + @Bean + public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) { + SchedulerFactoryBean factory = new SchedulerFactoryBean(); + factory.setDataSource(dataSource); + + //quartz参数 + Properties prop = new Properties(); + prop.put("org.quartz.scheduler.instanceName", "ZcloudScheduler"); + prop.put("org.quartz.scheduler.instanceId", "AUTO"); + //线程池配置 + prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); + prop.put("org.quartz.threadPool.threadCount", "20"); + prop.put("org.quartz.threadPool.threadPriority", "5"); + //JobStore配置 + prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore"); + //集群配置 + prop.put("org.quartz.jobStore.isClustered", "true"); + prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); + prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); + + prop.put("org.quartz.jobStore.misfireThreshold", "12000"); + prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); + prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); + + factory.setQuartzProperties(prop); + + factory.setSchedulerName("ZcloudScheduler"); + //延时启动 + factory.setStartupDelay(30); + factory.setApplicationContextSchedulerContextKey("applicationContextKey"); + //可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 + factory.setOverwriteExistingJobs(true); + //设置自动启动,默认为true + factory.setAutoStartup(true); + + return factory; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/controller/ScheduleJobController.java b/review_repo/src/main/java/com/zcloud/modules/job/controller/ScheduleJobController.java new file mode 100644 index 0000000..4b06b8d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/controller/ScheduleJobController.java @@ -0,0 +1,123 @@ +package com.zcloud.modules.job.controller; + +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.common.validator.ValidatorUtils; +import com.zcloud.modules.job.entity.ScheduleJobEntity; +import com.zcloud.modules.job.service.ScheduleJobService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +/** + * 定时任务 + * + */ +@RestController +@RequestMapping("/sys/schedule") +public class ScheduleJobController { + @Autowired + private ScheduleJobService scheduleJobService; + + /** + * 定时任务列表 + */ + @RequestMapping("/list") + //@RequiresPermission("sys:schedule:list") + public R list(@RequestBody Map params){ + PageUtils page = scheduleJobService.queryPage(params); + + return R.ok().put("page", page); + } + + /** + * 定时任务信息 + */ + @RequestMapping("/info") + //@RequiresPermission("sys:schedule:info") + public R info(@RequestBody ScheduleJobEntity scheduleJob){ + ScheduleJobEntity schedule = scheduleJobService.getById(scheduleJob.getJobId()); + return R.ok().put("schedule", schedule); + } + + /** + * 保存定时任务 + */ + @SysLog("保存定时任务") + @RequestMapping("/save") + //@RequiresPermission("sys:schedule:save") + public R save(@RequestBody ScheduleJobEntity scheduleJob){ + ValidatorUtils.validateEntity(scheduleJob); + + scheduleJobService.saveJob(scheduleJob); + + return R.ok(); + } + + /** + * 修改定时任务 + */ + @SysLog("修改定时任务") + @RequestMapping("/update") + //@RequiresPermission("sys:schedule:update") + public R update(@RequestBody ScheduleJobEntity scheduleJob){ + ValidatorUtils.validateEntity(scheduleJob); + + scheduleJobService.update(scheduleJob); + + return R.ok(); + } + + /** + * 删除定时任务 + */ + @SysLog("删除定时任务") + @RequestMapping("/delete") + //@RequiresPermission("sys:schedule:delete") + public R delete(@RequestBody ScheduleJobEntity scheduleJob){ + scheduleJobService.removeById(scheduleJob.getJobId()); + + return R.ok(); + } + + /** + * 立即执行任务 + */ + @SysLog("立即执行任务") + @RequestMapping("/run") + //@RequiresPermission("sys:schedule:run") + public R run(@RequestBody ScheduleJobEntity scheduleJob){ + scheduleJobService.run(scheduleJob.getJobId()); + + return R.ok(); + } + + /** + * 暂停定时任务 + */ + @SysLog("暂停定时任务") + @RequestMapping("/pause") + //@RequiresPermission("sys:schedule:pause") + public R pause(@RequestBody ScheduleJobEntity scheduleJob){ + scheduleJobService.pause(scheduleJob.getJobId()); + + return R.ok(); + } + + /** + * 恢复定时任务 + */ + @SysLog("恢复定时任务") + @RequestMapping("/resume") + //@RequiresPermission("sys:schedule:resume") + public R resume(@RequestBody ScheduleJobEntity scheduleJob){ + scheduleJobService.resume(scheduleJob.getJobId()); + + return R.ok(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/controller/ScheduleJobLogController.java b/review_repo/src/main/java/com/zcloud/modules/job/controller/ScheduleJobLogController.java new file mode 100644 index 0000000..bb2692b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/controller/ScheduleJobLogController.java @@ -0,0 +1,48 @@ + + +package com.zcloud.modules.job.controller; + +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.modules.job.entity.ScheduleJobLogEntity; +import com.zcloud.modules.job.service.ScheduleJobLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +/** + * 定时任务日志 + * + * + */ +@RestController +@RequestMapping("/sys/scheduleLog") +public class ScheduleJobLogController { + @Autowired + private ScheduleJobLogService scheduleJobLogService; + + /** + * 定时任务日志列表 + */ + @RequestMapping("/list") + //@RequiresPermission("sys:schedule:log") + public R list(@RequestBody Map params){ + PageUtils page = scheduleJobLogService.queryPage(params); + + return R.ok().put("page", page); + } + + /** + * 定时任务日志信息 + */ + @RequestMapping("/info/{logId}") + public R info(@PathVariable("logId") String logId){ + ScheduleJobLogEntity log = scheduleJobLogService.getById(logId); + + return R.ok().put("log", log); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/dao/ScheduleJobDao.java b/review_repo/src/main/java/com/zcloud/modules/job/dao/ScheduleJobDao.java new file mode 100644 index 0000000..b1af802 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/dao/ScheduleJobDao.java @@ -0,0 +1,23 @@ + + +package com.zcloud.modules.job.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.job.entity.ScheduleJobEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Map; + +/** + * 定时任务 + * + * + */ +@Mapper +public interface ScheduleJobDao extends BaseMapper { + + /** + * 批量更新状态 + */ + int updateBatch(Map map); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/dao/ScheduleJobLogDao.java b/review_repo/src/main/java/com/zcloud/modules/job/dao/ScheduleJobLogDao.java new file mode 100644 index 0000000..902f4c1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/dao/ScheduleJobLogDao.java @@ -0,0 +1,17 @@ + + +package com.zcloud.modules.job.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.job.entity.ScheduleJobLogEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 定时任务日志 + * + * + */ +@Mapper +public interface ScheduleJobLogDao extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/entity/ScheduleJobEntity.java b/review_repo/src/main/java/com/zcloud/modules/job/entity/ScheduleJobEntity.java new file mode 100644 index 0000000..d075fa1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/entity/ScheduleJobEntity.java @@ -0,0 +1,89 @@ + + +package com.zcloud.modules.job.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + +/** + * 定时任务 + * + * + */ +@Data +@TableName("schedule_job_csy") +public class ScheduleJobEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 任务调度参数key + */ + public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY"; + + /** + * 任务id + */ + @TableId(value = "job_id",type = IdType.ASSIGN_UUID) + @TableField(value = "job_id") + @JsonProperty(value = "jobId") + private String jobId; + + /** + * spring bean名称 + */ + @NotBlank(message="bean名称不能为空") + @TableField(value = "bean_name") + @JsonProperty(value = "beanName") + private String beanName; + + /** + * 参数 + */ + @TableField(value = "params") + @JsonProperty(value = "params") + private String params; + + /** + * cron表达式 + */ + @NotBlank(message="cron表达式不能为空") + @TableField(value = "cron_expression") + @JsonProperty(value = "cronExpression") + private String cronExpression; + + /** + * 任务状态 + */ + @TableField(value = "status") + @JsonProperty(value = "status") + private Integer status; + + /** + * 备注 + */ + @TableField(value = "remark") + @JsonProperty(value = "remark") + private String remark; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @TableField(value = "create_time") + @JsonProperty(value = "create_time") + private Date createTime; + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/entity/ScheduleJobLogEntity.java b/review_repo/src/main/java/com/zcloud/modules/job/entity/ScheduleJobLogEntity.java new file mode 100644 index 0000000..f5bebfc --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/entity/ScheduleJobLogEntity.java @@ -0,0 +1,84 @@ + + +package com.zcloud.modules.job.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 定时任务日志 + * + * + */ +@Data +@TableName("schedule_job_log_csy") +public class ScheduleJobLogEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 日志id + */ + @TableId(value = "log_id",type = IdType.ASSIGN_UUID) + @TableField(value = "log_id") + @JsonProperty(value = "log_id") + private String logId; + + /** + * 任务id + */ + @TableField(value = "job_id") + @JsonProperty(value = "job_id") + private String jobId; + + /** + * spring bean名称 + */ + @TableField(value = "bean_name") + @JsonProperty(value = "bean_name") + private String beanName; + + /** + * 参数 + */ + @TableField(value = "params") + @JsonProperty(value = "params") + private String params; + + /** + * 任务状态 0:成功 1:失败 + */ + @TableField(value = "status") + @JsonProperty(value = "status") + private Integer status; + + /** + * 失败信息 + */ + @TableField(value = "error") + @JsonProperty(value = "error") + private String error; + + /** + * 耗时(单位:毫秒) + */ + @TableField(value = "times") + @JsonProperty(value = "times") + private Integer times; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @TableField(value = "create_time") + @JsonProperty(value = "create_time") + private Date createTime; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/service/ScheduleJobLogService.java b/review_repo/src/main/java/com/zcloud/modules/job/service/ScheduleJobLogService.java new file mode 100644 index 0000000..576c023 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/service/ScheduleJobLogService.java @@ -0,0 +1,20 @@ + + +package com.zcloud.modules.job.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.job.entity.ScheduleJobLogEntity; + +import java.util.Map; + +/** + * 定时任务日志 + * + * + */ +public interface ScheduleJobLogService extends IService { + + PageUtils queryPage(Map params); + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/service/ScheduleJobService.java b/review_repo/src/main/java/com/zcloud/modules/job/service/ScheduleJobService.java new file mode 100644 index 0000000..dfac1f4 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/service/ScheduleJobService.java @@ -0,0 +1,54 @@ + + +package com.zcloud.modules.job.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.job.entity.ScheduleJobEntity; + +import java.util.Map; + +/** + * 定时任务 + * + * + */ +public interface ScheduleJobService extends IService { + + PageUtils queryPage(Map params); + + /** + * 保存定时任务 + */ + void saveJob(ScheduleJobEntity scheduleJob); + + /** + * 更新定时任务 + */ + void update(ScheduleJobEntity scheduleJob); + + /** + * 批量删除定时任务 + */ + void deleteBatch(String[] jobIds); + + /** + * 批量更新定时任务状态 + */ + boolean update(String jobId, int status); + + /** + * 立即执行 + */ + void run(String jobId); + + /** + * 暂停运行 + */ + void pause(String jobId); + + /** + * 恢复运行 + */ + void resume(String jobId); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/service/impl/ScheduleJobLogServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/job/service/impl/ScheduleJobLogServiceImpl.java new file mode 100644 index 0000000..68caef1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/service/impl/ScheduleJobLogServiceImpl.java @@ -0,0 +1,33 @@ + + +package com.zcloud.modules.job.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.Query; +import com.zcloud.modules.job.dao.ScheduleJobLogDao; +import com.zcloud.modules.job.entity.ScheduleJobLogEntity; +import com.zcloud.modules.job.service.ScheduleJobLogService; +import org.apache.commons.lang.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Service("scheduleJobLogService") +public class ScheduleJobLogServiceImpl extends ServiceImpl implements ScheduleJobLogService { + + @Override + public PageUtils queryPage(Map params) { + String jobId = (String)params.get("jobId"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().like(StringUtils.isNotBlank(jobId),"job_id", jobId) + ); + + return new PageUtils(page); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/service/impl/ScheduleJobServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/job/service/impl/ScheduleJobServiceImpl.java new file mode 100644 index 0000000..9f3ad8f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/service/impl/ScheduleJobServiceImpl.java @@ -0,0 +1,119 @@ + + +package com.zcloud.modules.job.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.Constant; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.Query; +import com.zcloud.modules.job.dao.ScheduleJobDao; +import com.zcloud.modules.job.entity.ScheduleJobEntity; +import com.zcloud.modules.job.service.ScheduleJobService; +import com.zcloud.modules.job.utils.ScheduleUtils; +import org.apache.commons.lang.StringUtils; +import org.quartz.CronTrigger; +import org.quartz.Scheduler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Service("scheduleJobService") +public class ScheduleJobServiceImpl extends ServiceImpl implements ScheduleJobService { + @Autowired + private Scheduler scheduler; + + /** + * 项目启动时,初始化定时器 + */ + @PostConstruct + public void init(){ + List scheduleJobList = this.list(); + for(ScheduleJobEntity scheduleJob : scheduleJobList){ + CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId()); + //如果不存在,则创建 + if(cronTrigger == null) { + ScheduleUtils.createScheduleJob(scheduler, scheduleJob); + }else { + ScheduleUtils.updateScheduleJob(scheduler, scheduleJob); + } + } + } + + @Override + public PageUtils queryPage(Map params) { + String beanName = (String)params.get("beanName"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper ().like(StringUtils.isNotBlank(beanName),"bean_name", beanName) + ); + + return new PageUtils(page); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveJob(ScheduleJobEntity scheduleJob) { + scheduleJob.setCreateTime(new Date()); + scheduleJob.setStatus(Constant.ScheduleStatus.NORMAL.getValue()); + this.save(scheduleJob); + + ScheduleUtils.createScheduleJob(scheduler, scheduleJob); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ScheduleJobEntity scheduleJob) { + ScheduleUtils.updateScheduleJob(scheduler, scheduleJob); + + this.updateById(scheduleJob); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteBatch(String[] jobIds) { + for(String jobId : jobIds){ + ScheduleUtils.deleteScheduleJob(scheduler, jobId); + } + //删除数据 + this.removeByIds(Arrays.asList(jobIds)); + } + + @Override + public boolean update(String jobId, int status){ + return this.update(new UpdateWrapper().eq("job_id", jobId).set("status", status)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void run(String jobId) { + ScheduleUtils.run(scheduler, this.getById(jobId)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void pause(String jobId) { + ScheduleUtils.pauseJob(scheduler, jobId); + + update(jobId, Constant.ScheduleStatus.PAUSE.getValue()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void resume(String jobId) { + ScheduleUtils.resumeJob(scheduler, jobId); + + update(jobId, Constant.ScheduleStatus.NORMAL.getValue()); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/task/ITask.java b/review_repo/src/main/java/com/zcloud/modules/job/task/ITask.java new file mode 100644 index 0000000..70bb354 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/task/ITask.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.job.task; + +/** + * 定时任务接口,所有定时任务都要实现该接口 + * + * + */ +public interface ITask { + + /** + * 执行定时任务接口 + * + * @param params 参数,多参数使用JSON数据 + */ + void run(String params); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/task/TestTask.java b/review_repo/src/main/java/com/zcloud/modules/job/task/TestTask.java new file mode 100644 index 0000000..1c560c6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/task/TestTask.java @@ -0,0 +1,22 @@ +package com.zcloud.modules.job.task; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * 测试定时任务(演示Demo,可删除) + * + * testTask为spring bean的名称 + * + * + */ +@Component("testTask") +public class TestTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public void run(String params){ + logger.debug("TestTask定时任务正在执行,参数为:{}", params); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/utils/ScheduleJob.java b/review_repo/src/main/java/com/zcloud/modules/job/utils/ScheduleJob.java new file mode 100644 index 0000000..f4dc3a5 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/utils/ScheduleJob.java @@ -0,0 +1,75 @@ +package com.zcloud.modules.job.utils; + +import com.alibaba.fastjson.JSON; +import com.zcloud.common.utils.SpringContextUtils; +import com.zcloud.modules.job.entity.ScheduleJobEntity; +import com.zcloud.modules.job.entity.ScheduleJobLogEntity; +import com.zcloud.modules.job.service.ScheduleJobLogService; +import org.apache.commons.lang.StringUtils; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.quartz.QuartzJobBean; + +import java.lang.reflect.Method; +import java.util.Date; + + +/** + * 定时任务 + * + */ +public class ScheduleJob extends QuartzJobBean { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + protected void executeInternal(JobExecutionContext context) throws JobExecutionException { + Object temp = context.getMergedJobDataMap().get((ScheduleJobEntity.JOB_PARAM_KEY)); + ScheduleJobEntity scheduleJob; + String string = JSON.toJSON(temp).toString(); + scheduleJob = JSON.parseObject(string,ScheduleJobEntity.class); + + //获取spring bean + ScheduleJobLogService scheduleJobLogService = (ScheduleJobLogService) SpringContextUtils.getBean("scheduleJobLogService"); + + //数据库保存执行记录 + ScheduleJobLogEntity log = new ScheduleJobLogEntity(); + log.setJobId(scheduleJob.getJobId()); + log.setBeanName(scheduleJob.getBeanName()); + log.setParams(scheduleJob.getParams()); + log.setCreateTime(new Date()); + + //任务开始时间 + long startTime = System.currentTimeMillis(); + + try { + //执行任务 + logger.debug("任务准备执行,任务ID:" + scheduleJob.getJobId()); + + Object target = SpringContextUtils.getBean(scheduleJob.getBeanName()); + Method method = target.getClass().getDeclaredMethod("run", String.class); + method.invoke(target, scheduleJob.getParams()); + + //任务执行总时长 + long times = System.currentTimeMillis() - startTime; + log.setTimes((int)times); + //任务状态 0:成功 1:失败 + log.setStatus(0); + + logger.debug("任务执行完毕,任务ID:" + scheduleJob.getJobId() + " 总共耗时:" + times + "毫秒"); + } catch (Exception e) { + logger.error("任务执行失败,任务ID:" + scheduleJob.getJobId(), e); + + //任务执行总时长 + long times = System.currentTimeMillis() - startTime; + log.setTimes((int)times); + + //任务状态 0:成功 1:失败 + log.setStatus(1); + log.setError(StringUtils.substring(e.toString(), 0, 2000)); + }finally { + scheduleJobLogService.save(log); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/job/utils/ScheduleUtils.java b/review_repo/src/main/java/com/zcloud/modules/job/utils/ScheduleUtils.java new file mode 100644 index 0000000..cba148e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/job/utils/ScheduleUtils.java @@ -0,0 +1,150 @@ + + +package com.zcloud.modules.job.utils; + +import com.zcloud.common.exception.ZException; +import com.zcloud.common.utils.Constant; +import com.zcloud.modules.job.entity.ScheduleJobEntity; +import org.quartz.*; + +/** + * 定时任务工具类 + * + */ +public class ScheduleUtils { + private final static String JOB_NAME = "TASK_"; + + /** + * 获取触发器key + */ + public static TriggerKey getTriggerKey(String jobId) { + return TriggerKey.triggerKey(JOB_NAME + jobId); + } + + /** + * 获取jobKey + */ + public static JobKey getJobKey(String jobId) { + return JobKey.jobKey(JOB_NAME + jobId); + } + + /** + * 获取表达式触发器 + */ + public static CronTrigger getCronTrigger(Scheduler scheduler, String jobId) { + try { + return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId)); + } catch (SchedulerException e) { + throw new ZException("获取定时任务CronTrigger出现异常", e); + } + } + + /** + * 创建定时任务 + */ + public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) { + try { + //构建job信息 + JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getJobId())).build(); + + //表达式调度构建器 + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression()) + .withMisfireHandlingInstructionDoNothing(); + + //按新的cronExpression表达式构建一个新的trigger + CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getJobId())).withSchedule(scheduleBuilder).build(); + + //放入参数,运行时的方法可以获取 + jobDetail.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob); + + scheduler.scheduleJob(jobDetail, trigger); + + //暂停任务 + if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){ + pauseJob(scheduler, scheduleJob.getJobId()); + } + } catch (SchedulerException e) { + throw new ZException("创建定时任务失败", e); + } + } + + /** + * 更新定时任务 + */ + public static void updateScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) { + try { + TriggerKey triggerKey = getTriggerKey(scheduleJob.getJobId()); + + //表达式调度构建器 + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression()) + .withMisfireHandlingInstructionDoNothing(); + + CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getJobId()); + + //按新的cronExpression表达式重新构建trigger + trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); + + //参数 + trigger.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob); + + scheduler.rescheduleJob(triggerKey, trigger); + + //暂停任务 + if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){ + pauseJob(scheduler, scheduleJob.getJobId()); + } + + } catch (SchedulerException e) { + throw new ZException("更新定时任务失败", e); + } + } + + /** + * 立即执行任务 + */ + public static void run(Scheduler scheduler, ScheduleJobEntity scheduleJob) { + try { + //参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob); + + scheduler.triggerJob(getJobKey(scheduleJob.getJobId()), dataMap); + } catch (SchedulerException e) { + e.printStackTrace(); + throw new ZException("立即执行定时任务失败", e); + } + } + + /** + * 暂停任务 + */ + public static void pauseJob(Scheduler scheduler, String jobId) { + try { + scheduler.pauseJob(getJobKey(jobId)); + } catch (SchedulerException e) { + throw new ZException("暂停定时任务失败", e); + } + } + + /** + * 恢复任务 + */ + public static void resumeJob(Scheduler scheduler, String jobId) { + try { + scheduler.resumeJob(getJobKey(jobId)); + } catch (SchedulerException e) { + throw new ZException("暂停定时任务失败", e); + } + } + + /** + * 删除定时任务 + */ + public static void deleteScheduleJob(Scheduler scheduler, String jobId) { + try { + scheduler.deleteJob(getJobKey(jobId)); + } catch (SchedulerException e) { + throw new ZException("删除定时任务失败", e); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/controller/FourColourController.java b/review_repo/src/main/java/com/zcloud/modules/map/controller/FourColourController.java new file mode 100644 index 0000000..4a13295 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/controller/FourColourController.java @@ -0,0 +1,107 @@ +package com.zcloud.modules.map.controller; + + +import com.zcloud.modules.map.service.FourColourService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.HashMap; +import java.util.Map; + +/** + * 说明:地图四色四固定图层 + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/map/FourColour") +public class FourColourController{ + + @Autowired + private FourColourService fourColourService; + + + + /** + * 告警信息列表 + */ + @RequestMapping(value="/alarmStatistics") + public Object getAlarmStatistics(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return fourColourService.getAlarmStatistics(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } + + /** + * 人员车辆进场趋势分析 + */ + @RequestMapping(value="/personInAndCarIn") + @ResponseBody + public Object personInAndCarIn() throws Exception{ + return fourColourService.personInAndCarIn(); + } + + + /** + * 工单列表信息 + */ + @RequestMapping(value="/currentDayGdDetailInfor") + public Object currentDayGdDetailInfor(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return fourColourService.currentDayGdDetailInfor(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } + + /** + * 工单列表信息(新) 根据区域获取工单信息 + */ + @RequestMapping(value="/getGDDetailListByArea") + public Object getGDDetailListByArea(@RequestBody Map params) throws Exception{ + Map map = new HashMap<>(); + map.put("result","error"); + String pageNum = ""; + String pageSize = ""; + String str = ""; + String type = ""; + if(StringUtils.isEmpty(params.get("pageNum").toString())){ + map.put("msg","缺少必填参数pageNum"); + return map; + }else if(StringUtils.isEmpty(params.get("pageSize").toString())){ + map.put("msg","缺少必填参数pageSize"); + return map; + } + pageNum = params.get("pageNum").toString(); + pageSize = params.get("pageSize").toString(); + return fourColourService.getGDDetailListByArea(pageNum, pageSize, type, str); + + } + + + /** + * 车辆类型信息 + */ + @RequestMapping(value="/carTypeAnalysis") + public Object carTypeAnalysis(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return fourColourService.carTypeAnalysis(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/controller/MapController.java b/review_repo/src/main/java/com/zcloud/modules/map/controller/MapController.java new file mode 100644 index 0000000..659bcc6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/controller/MapController.java @@ -0,0 +1,59 @@ +package com.zcloud.modules.map.controller; + +import com.zcloud.modules.map.service.MapService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 说明:实时地图 + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/map/map") +public class MapController { + + @Autowired + private MapService mapService; + + + /** + * 查询闸机及摄像头数 + * @return + * @throws Exception + */ + @RequestMapping(value="/listMapSluiceCount") + public Object listMapSluiceCount() throws Exception{ + return mapService.listMapSluiceCount(); + } + + + /**获取工单信息 + * @throws Exception + */ + @RequestMapping(value="/getAreaDetail") + public Object getAreaDetail(@RequestBody Map params) throws Exception { + Map map = new HashMap<>(); + map.put("result","error"); + String pageNum = ""; + String pageSize = ""; + String str = ""; + String type = ""; + if(StringUtils.isEmpty(params.get("pageNum").toString())){ + map.put("msg","缺少必填参数pageNum"); + return map; + }else if(StringUtils.isEmpty(params.get("pageSize").toString())){ + map.put("msg","缺少必填参数pageSize"); + return map; + } + pageNum = params.get("pageNum").toString(); + pageSize = params.get("pageSize").toString(); + return mapService.getAreaDetail(pageNum, pageSize, type, str); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/controller/MapEightController.java b/review_repo/src/main/java/com/zcloud/modules/map/controller/MapEightController.java new file mode 100644 index 0000000..06409b0 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/controller/MapEightController.java @@ -0,0 +1,138 @@ +package com.zcloud.modules.map.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.common.utils.Tools; +import com.zcloud.modules.map.service.MapEightService; +import com.zcloud.modules.sys.dao.SysUserDao; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.modules.sys.service.SysUserService; +import com.zcloud.util.PerLocUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 说明:实时地图八项工作内容 + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/map/Eight") +public class MapEightController { + @Autowired + private MapEightService mapEightService; + @Autowired + private RestTemplate restTemplate; + @Autowired + private PerLocUtil perLocUtil; + @Value("${perLoc.url}") + private String url; + @Autowired + private SysUserDao sysUserDao; + + /** + * 根据用户id查询八项作业 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/findEightsByUserId") + public Object findEightsByUserId(@RequestBody Map params) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + String empNo = ""; + if(StringUtils.isEmpty(params.get("empNo").toString())){ + map.put("msg","缺少必填参数empNo"); + map.put("result","file"); + return map; + } + empNo = params.get("empNo").toString(); + PageData pd = new PageData(); + pd.put("empNo", empNo); + //获取八项作业信息 + List varList = mapEightService.findEightsByUserIds(pd); + //获取人员信息 + PageData byCardNo = sysUserDao.findByCardNo(pd); + //若本地查询不到调用Api接口查询 + if (Tools.isEmpty(byCardNo)) { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + ResponseEntity response = restTemplate.exchange(url + "/deploy/card/peopleDisplay?cardId=" + + empNo + , HttpMethod.GET, entity, String.class); + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if (responseObject.get("code") != null && responseObject.get("code").toString().equals("200")) { + List dataList = JSONObject.parseArray(JSON.toJSON(responseObject.get("data")).toString(), PageData.class); + if (dataList.size()>0) { + for (PageData pageData : dataList) { + PageData perPd = new PageData(); + perPd.put("DEPARTMENT_NAME",pageData.get("deptName")); + perPd.put("POST_NAME",pageData.get("officeName")); + byCardNo = perPd; + } + } + } + } + } + //调用工单信息接口 + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + ResponseEntity response = restTemplate.exchange(url + "/region/access/aListOfTicketsCurrentlyInProgress?workNumber=" + + empNo + , HttpMethod.GET, entity, String.class); + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if (responseObject.get("code") != null && responseObject.get("code").toString().equals("200")) { + List dataList = JSONObject.parseArray(JSON.toJSON(responseObject.get("data")).toString(), PageData.class); + if (dataList.size()>0) { + map.put("data",dataList); + }else { + map.put("data",new ArrayList<>()); + } + } + } + map.put("INFO",byCardNo); + map.put("varList", varList); + map.put("result", errInfo); + return map; + } + + /**获取动火防护措施 + * @param + * @throws Exception + */ + @RequestMapping(value="/getAllTickets") + public Object getAllTickets(@RequestBody Map params) throws Exception{ + Map map = new HashMap(); + String errInfo = "file"; + String workNumbers = ""; + if(StringUtils.isEmpty(params.get("workNumbers").toString())){ + map.put("msg","缺少必填参数empNo"); + map.put("result", errInfo); + return map; + } + workNumbers = params.get("workNumbers").toString(); + return mapEightService.getAllTickets(workNumbers); //根据ID读取 + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/controller/ObtainDisplayDataController.java b/review_repo/src/main/java/com/zcloud/modules/map/controller/ObtainDisplayDataController.java new file mode 100644 index 0000000..02fe961 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/controller/ObtainDisplayDataController.java @@ -0,0 +1,38 @@ +package com.zcloud.modules.map.controller; + +import com.zcloud.modules.map.service.UserPositionService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping("/map/ObtainDisplayData") +public class ObtainDisplayDataController{ + + @Autowired + private UserPositionService usersService; + + /** + * 获取电子围栏 + * @param params + * @return + * @throws Exception + */ + @RequestMapping(value="/getDianZiWeiLanList") + public Object getDianZiWeiLanList(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return usersService.getDianZiWeiLanList(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/controller/UserPositionController.java b/review_repo/src/main/java/com/zcloud/modules/map/controller/UserPositionController.java new file mode 100644 index 0000000..e7d0a8d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/controller/UserPositionController.java @@ -0,0 +1,111 @@ +package com.zcloud.modules.map.controller; + + +import com.zcloud.modules.map.service.UserPositionService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping("/map/UserPosition") +public class UserPositionController { + @Autowired + private UserPositionService usersService; + + /** + * 获取人员定位 + * @return + * @throws Exception + */ + @RequestMapping(value="/getCurrentLocationOnline") + @ResponseBody + public Object getCurrentLocationOnline() throws Exception{ + return usersService.getCurrentLocation(); + } + + @RequestMapping(value="/getCarCurrentLocationOnline") + @ResponseBody + public Object getCarCurrentLocationOnline() throws Exception{ + return usersService.getCarCurrentLocation(); + } + + /** + * 查询人员在线及统计数据 + * @return + * @throws Exception + */ + @RequestMapping(value = "/getCurrentPersonnelData") + public Object getCurrentPersonnelData(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return usersService.getCurrentPersonnelData(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } + + /** + * 查询车辆在线及统计数据 + * @return + * @throws Exception + */ + @RequestMapping(value = "/getCurrentCarData") + public Object getCurrentCarData(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return usersService.getCurrentCarData(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } + + /** + * 获取人员定位统计列表 + * @return + * @throws Exception + */ + @RequestMapping(value = "/personPositioningStatistics") + public Object getPersonPositioningStatistics(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return usersService.getPersonPositioningStatistics(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } + + /** + * 获取车辆定位统计列表 + * @return + * @throws Exception + */ + @RequestMapping(value = "/carPositioningStatistics") + public Object carPositioningStatistics(@RequestBody Map params) throws Exception{ + if(StringUtils.isNotEmpty(params.get("route").toString())){ + return usersService.getCarPositioningStatistics(params.get("route").toString()); + }else { + Map map = new HashMap<>(); + map.put("result","error"); + map.put("msg","缺少必填参数route"); + return map; + } + } + + @RequestMapping(value="/getCurrentLocationOnlineCount") + @ResponseBody + public Object getCurrentLocationOnlineCount() throws Exception{ + return usersService.getCurrentLocationCount(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/mapper/MapEightMapper.java b/review_repo/src/main/java/com/zcloud/modules/map/mapper/MapEightMapper.java new file mode 100644 index 0000000..408fd95 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/mapper/MapEightMapper.java @@ -0,0 +1,22 @@ +package com.zcloud.modules.map.mapper; + + + +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 说明:重点工程处罚 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +@Mapper +public interface MapEightMapper { + + List findEightsByUserIds(PageData pd); +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/mapper/PlatformvideomanagementMapper.java b/review_repo/src/main/java/com/zcloud/modules/map/mapper/PlatformvideomanagementMapper.java new file mode 100644 index 0000000..99ecab6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/mapper/PlatformvideomanagementMapper.java @@ -0,0 +1,19 @@ +package com.zcloud.modules.map.mapper; + +import com.zcloud.modules.sys.entity.PageData; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 说明:平台视频管理 + * 作者:luoxiaobao + * 时间:2023-07-21 + * 官网:www.zcloudchina.com + */ +@Mapper +public interface PlatformvideomanagementMapper { + + List listAllForMap(PageData pd); +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/FourColourService.java b/review_repo/src/main/java/com/zcloud/modules/map/service/FourColourService.java new file mode 100644 index 0000000..7ebdf6d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/FourColourService.java @@ -0,0 +1,23 @@ +package com.zcloud.modules.map.service; + + +/** + * 说明:地图四色四固定图层 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +public interface FourColourService { + + Object getAlarmStatistics(String route)throws Exception; + + Object personInAndCarIn()throws Exception; + + Object currentDayGdDetailInfor(String route)throws Exception; + + Object getGDDetailListByArea(String pageNum,String pageSize,String str,String type)throws Exception; + + Object carTypeAnalysis(String route)throws Exception; + +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/MapEightService.java b/review_repo/src/main/java/com/zcloud/modules/map/service/MapEightService.java new file mode 100644 index 0000000..6cbaa61 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/MapEightService.java @@ -0,0 +1,29 @@ +package com.zcloud.modules.map.service; + + + +import cn.hutool.db.Page; +import com.zcloud.modules.sys.entity.PageData; + +import java.util.List; +import java.util.Map; + +/** + * 说明:实施地图八项作业 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +public interface MapEightService { + + /** + * 获取当前作业人的八项作业信息 + * @param empNo 工号 + * @return + * @throws Exception + */ + List findEightsByUserIds(PageData pd)throws Exception; + + Object getAllTickets(String workNumbers) throws Exception; +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/MapService.java b/review_repo/src/main/java/com/zcloud/modules/map/service/MapService.java new file mode 100644 index 0000000..966eb28 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/MapService.java @@ -0,0 +1,21 @@ +package com.zcloud.modules.map.service; + + +import com.zcloud.modules.sys.entity.PageData; + +import java.util.Map; + +/** + * 说明:地图四色四固定图层 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +public interface MapService { + + Map listMapSluiceCount(); + + Object getAreaDetail(String pageNum,String pageSize,String str,String type)throws Exception; + +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/UserPositionService.java b/review_repo/src/main/java/com/zcloud/modules/map/service/UserPositionService.java new file mode 100644 index 0000000..fddc32b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/UserPositionService.java @@ -0,0 +1,27 @@ +package com.zcloud.modules.map.service; + + +/** + * 说明:用户服务接口 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public interface UserPositionService { + + + Object getCurrentLocation() throws Exception; + + Object getCarCurrentLocation()throws Exception; + + Object getCurrentPersonnelData(String route) throws Exception; + + Object getCurrentCarData(String route)throws Exception; + + Object getPersonPositioningStatistics(String route) throws Exception; + + Object getCarPositioningStatistics(String route)throws Exception; + + Object getCurrentLocationCount(); + + Object getDianZiWeiLanList(String route)throws Exception; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/impl/FourColourServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/FourColourServiceImpl.java new file mode 100644 index 0000000..c22a216 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/FourColourServiceImpl.java @@ -0,0 +1,266 @@ +package com.zcloud.modules.map.service.impl; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.common.utils.DateUtil; +import com.zcloud.modules.map.service.FourColourService; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.util.HttpRequestUtil; +import com.zcloud.util.PerLocUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; + +import java.util.*; +import java.util.stream.Collectors; + + +/** + * 说明:地图四色四固定图层 + * 作者:zhaoyu + * 时间:2024-05-20 + * 官网:www.zcloudchina.com + */ +@Service +@Transactional //开启事物 +public class FourColourServiceImpl implements FourColourService { + + + @Autowired + private PerLocUtil perLocUtil; + + @Autowired + private RestTemplate restTemplate; + + @Value("${perLoc.url}") + private String url; + + @Override + public Object getAlarmStatistics(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if(response.get("data") != null){ + map.put("varList",response.get("data")); + } + } + map.put("result",errInfo); + return map; + } + + + @Override + public Object personInAndCarIn() throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + List varList = new ArrayList<>(); + // 车辆趋势 + String carPath = url +"/region/access/inOrOutFactoryCarAnalysis?dateStr=day"; + String _response = HttpRequestUtil.doGetUser(carPath, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if(response.get("detailList") != null){ + varList = JSONObject.parseArray(JSON.toJSON(response.get("detailList")).toString(), PageData.class); + } + } + //车辆趋势完成 + //人员趋势 + //开始时间为当天0点 + String start = DateUtil.getDay()+" 00:00:00"; + //结束时间为当前时间 + String end = DateUtil.date2Str(new Date()); + String personPath = url + "/region/access/bayonetPersonnelEntryAndExitRecords?"+"fstartDate="+start+"&fendDate="+end+"&empNo=&empId=&entrystatus=&accId="; + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + + ResponseEntity response = restTemplate.exchange(personPath, HttpMethod.GET, entity, String.class); + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if(responseObject.get("code") != null && responseObject.get("code").toString().equals("200") ){ + List presonList = JSONObject.parseArray(JSON.toJSON(responseObject.get("data")).toString(), PageData.class); + presonList = presonList.stream().filter(n -> "0".equals(n.getString("entrystatus"))).collect(Collectors.toList()); + Map> listMap = presonList.stream().collect(Collectors.groupingBy(n-> n.getString("chtime").substring(0,13))); + for(PageData pageData:varList){ + if(listMap.containsKey(pageData.getString("fdate"))){ + pageData.put("personNum",listMap.get(pageData.getString("fdate")).size()); + }else { + pageData.put("personNum",0); + } + } + } + } else { + // 处理非成功状态码的情况 + System.out.println("Request failed with status code: " + response.getStatusCode()); + } + map.put("varList",varList); + map.put("result",errInfo); + return map; + } + + @Override + public Object currentDayGdDetailInfor(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if(response.get("list") != null){ + map.put("varList",response.get("list")); + } + } + map.put("result",errInfo); + return map; + } + + @Override + public Object getGDDetailListByArea(String pageNum,String pageSize,String str,String type) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + List varList = new ArrayList<>(); + List gdList = new ArrayList<>(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + ResponseEntity response = restTemplate.exchange(url + "/region/region/list?pageNum=" + + pageNum + + "&pageSize=" + pageSize + + "&str=" + str + + "&type=" + type + , HttpMethod.GET, entity, String.class); + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if (responseObject.get("code") != null && responseObject.get("code").toString().equals("200")) { + varList = JSONObject.parseArray(JSON.toJSON(responseObject.get("rows")).toString(), PageData.class); + for (PageData pageData : varList) { + if ( + pageData.getString("regName").equals("一期码头") + || pageData.getString("regName").equals("二期码头") + || pageData.getString("regName").equals("一期堆场") + || pageData.getString("regName").equals("二期堆场") + || pageData.getString("regName").equals("杂货码头") + ) { + PageData gdTongJi = new PageData(); + if (pageData.getString("regName").equals("杂货码头")) { + gdTongJi.put("regName","杂货码头场区"); + } else { + gdTongJi.put("regName",pageData.getString("regName")); + } + int red = 0; + int orange = 0; + int blue = 0; + int yellow = 0; + ResponseEntity tempResponse = restTemplate.exchange(url + "/region/region/getPsnByRegionName?regionName=" + pageData.getString("regName"), HttpMethod.GET, entity, String.class); + if (tempResponse.getStatusCode().is2xxSuccessful()) { + String tempResponseBody = tempResponse.getBody(); // 获取响应体字符串 + JSONObject tempResponseObject = JSONObject.parseObject(tempResponseBody); + if (tempResponseObject.get("code") != null && tempResponseObject.get("code").toString().equals("200")) { + List pList = JSONObject.parseArray(JSON.toJSON(tempResponseObject.get("data")).toString(), PageData.class); + //不是人员数 + if (pList.size()>0) { + for (PageData data : pList) { + List psn = JSONArray.parseArray(data.get("psn").toString(), PageData.class); + for (PageData person : psn) { + //根据人员获取工单 + String path = url + "/region/access/aListOfTicketsCurrentlyInProgress?workNumber=" + person.getString("empNo"); + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject result = JSONObject.parseObject(_response); + if(result.get("data") != null){ + List dataList = JSONObject.parseArray(result.getString("data"), PageData.class); + for (PageData gdData : dataList) { + //工单信息 + if (gdData.getString("fcolorStr").equals("红")) { + red+=1; + } else if (gdData.getString("fcolorStr").equals("橙")) { + orange+=1; + } else if (gdData.getString("fcolorStr").equals("黄")) { + yellow+=1; + } else if (gdData.getString("fcolorStr").equals("蓝")) { + blue+=1; + } + } + } + } + } + } + } + } + } + gdTongJi.put("red",red); + gdTongJi.put("blue",blue); + gdTongJi.put("yellow",yellow); + gdTongJi.put("orange",orange); + gdTongJi.put("total",red+blue+yellow+orange); + gdList.add(gdTongJi); + } + } + } else { + // 处理非成功状态码的情况 + System.out.println("Request failed with status code: " + response.getStatusCode()); + } + } + map.put("result",errInfo); + ArrayList finalGDList = new ArrayList<>(); + PageData yiErQiDuiChang = new PageData(); + yiErQiDuiChang.put("regName","一、二期堆场"); + int red = 0; + int orange = 0; + int yellow = 0; + int blue = 0; + int total = 0; + for (PageData gongDan : gdList) { + if (gongDan.get("regName").equals("二期堆场") || gongDan.get("regName").equals("一期堆场")) { + red = red + Integer.parseInt(gongDan.getString("red")); + orange = orange + Integer.parseInt(gongDan.getString("orange")); + yellow = yellow + Integer.parseInt(gongDan.getString("yellow")); + blue = blue + Integer.parseInt(gongDan.getString("blue")); + total = total + Integer.parseInt(gongDan.getString("total")); + } else { + finalGDList.add(gongDan); + } + } + yiErQiDuiChang.put("red",red); + yiErQiDuiChang.put("orange",orange); + yiErQiDuiChang.put("yellow",yellow); + yiErQiDuiChang.put("blue",blue); + yiErQiDuiChang.put("total",total); + finalGDList.add(yiErQiDuiChang); + map.put("gdList",finalGDList); + return map; + } + + @Override + public Object carTypeAnalysis(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if(response.get("list") != null){ + map.put("varList",response.get("list")); + } + } + map.put("result",errInfo); + return map; + } + +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/impl/MapEightServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/MapEightServiceImpl.java new file mode 100644 index 0000000..d6b2ce1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/MapEightServiceImpl.java @@ -0,0 +1,83 @@ +package com.zcloud.modules.map.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.modules.map.mapper.MapEightMapper; +import com.zcloud.modules.map.service.MapEightService; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.util.HttpRequestUtil; +import com.zcloud.util.PerLocUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 说明:实时地图八项工作 + * 作者:luoxiaobao + * 时间:2022-09-21 + * 官网:www.zcloudchina.com + */ +@Service +@Transactional //开启事物 +public class MapEightServiceImpl implements MapEightService { + + @Resource + private MapEightMapper mapEightMapper; + + @Autowired + private PerLocUtil perLocUtil; + + @Value("${perLoc.url}") + private String url; + + @Override + public List findEightsByUserIds(PageData pd) throws Exception { + return mapEightMapper.findEightsByUserIds(pd); + } + + @Override + public Object getAllTickets(String workNumbers) throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + Set redList = new HashSet(); + Set orangeList = new HashSet(); + Set yellowList = new HashSet(); + String[] split = workNumbers.split(","); + if (split.length > 0) { + for (String workNumber : split) { + String _response = HttpRequestUtil.doGetUser( url + "/region/access/aListOfTicketsCurrentlyInProgress?workNumber=" + workNumber, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("data") != null){ + List data = JSONObject.parseArray(JSON.toJSON(response.get("data")).toString(), PageData.class); + for (PageData pageData : data) { + if(StringUtils.isNotEmpty(pageData.getString("fcolor")) && StringUtils.isNotEmpty(pageData.getString("cardNo"))){ + if (pageData.getString("fcolor").equals("0")){ + yellowList.add(pageData.getString("cardNo")); + } + if (pageData.getString("fcolor").equals("1")){ + orangeList.add(pageData.getString("cardNo")); + } + if (pageData.getString("fcolor").equals("2")){ + redList.add(pageData.getString("cardNo")); + } + } + } + } + } + } + } + map.put("redList",redList); + map.put("orangeList",orangeList); + map.put("yellowList",yellowList); + map.put("result", errInfo); + return map; + } +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/impl/MapServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/MapServiceImpl.java new file mode 100644 index 0000000..ff1bb35 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/MapServiceImpl.java @@ -0,0 +1,155 @@ +package com.zcloud.modules.map.service.impl; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.modules.map.mapper.PlatformvideomanagementMapper; +import com.zcloud.modules.map.service.MapService; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.util.PerLocUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.*; + + +/** + * 说明:地图四色四固定图层 + * 作者:zhaoyu + * 时间:2024-05-20 + * 官网:www.zcloudchina.com + */ +@Service +@Transactional //开启事物 +public class MapServiceImpl implements MapService { + + + @Autowired + private PerLocUtil perLocUtil; + + @Autowired + private PlatformvideomanagementMapper platformvideomanagementMapper; + + @Autowired + private RestTemplate restTemplate; + + @Value("${perLoc.url}") + private String url; + + @Override + public Map listMapSluiceCount() { + PageData pd = new PageData(); + pd.put("CORPINFO_ID","8854edee3aa94be496cee676b6d4845a"); + List cameraList = platformvideomanagementMapper.listAllForMap(pd); + Map result = restTemplate.getForObject(url + "/region/access/obtainBayonetData?type=", Map.class); + int onlinePerGate = 0; + int onlineCarGate = 0; + ArrayList peopleIds = new ArrayList<>(); + ArrayList carIds = new ArrayList<>(); + if (result != null && result.get("data") != null) { + List gateList = JSONObject.parseArray(JSON.toJSONString(result.get("data")), JSONObject.class); + if (gateList != null && gateList.size() > 0) { + for (JSONObject gate : gateList) { + if ("0".equals(gate.getString("type"))) { + carIds.add(gate.getString("id")); + } else if ("1".equals(gate.getString("type"))) { + peopleIds.add(gate.getString("id")); + } + } + } + } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String fendDate = simpleDateFormat.format(new Date()); + Calendar now = Calendar.getInstance(); + now.add(Calendar.MINUTE, -10); + Date before = now.getTime(); + String fstartDate = simpleDateFormat.format(before); + Map result2 = restTemplate.getForObject(url + "/region/access/bayonetPersonnelEntryAndExitRecords?fstartDate=" + fstartDate + "&fendDate=" + fendDate + "&empNo=&empId=&entrystatus=&accId=", Map.class); + if (result2 != null && result2.get("data") != null) { + List gateList = JSONObject.parseArray(JSON.toJSONString(result2.get("data")), JSONObject.class); + Set ids = new HashSet<>(); + for (JSONObject gateId : gateList) { + ids.add(gateId.getString("accId")); + } + for (String peopleId : peopleIds) { + if (ids.contains(peopleId)) { + onlinePerGate++; + } + } + for (String carId : carIds) { + if (ids.contains(carId)) { + onlineCarGate++; + } + } + } + result.put("onlinePerGate", onlinePerGate); + result.put("offlinePerGate", peopleIds.size() - onlinePerGate); + result.put("onlineCarGate", onlineCarGate); + result.put("offlineCarGate", carIds.size() - onlineCarGate); + result.put("cameraCount", cameraList.size()); + if ("200".equals(result.get("code").toString())) { + result.put("result", "success"); + } else { + result.put("result", "error"); + } + result.remove("data"); + return result; + } + + @Override + public Object getAreaDetail(String pageNum, String pageSize, String str, String type) throws Exception { + Map map = new HashMap<>(); + List varList = new ArrayList<>(); + String errInfo = "success"; + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + ResponseEntity response = restTemplate.exchange(url + "/region/region/list?pageNum=" + + pageNum + + "&pageSize=" + pageSize + + "&str=" + str + + "&type=" + type + , HttpMethod.GET, entity, String.class); + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if (responseObject.get("code") != null && responseObject.get("code").toString().equals("200")) { + varList = JSONObject.parseArray(JSON.toJSON(responseObject.get("rows")).toString(), PageData.class); + for (PageData pageData : varList) { + ResponseEntity tempResponse = restTemplate.exchange(url + "/region/region/getPsnByRegionName?regionName=" + pageData.getString("regName"), HttpMethod.GET, entity, String.class); + if (tempResponse.getStatusCode().is2xxSuccessful()) { + String tempResponseBody = tempResponse.getBody(); // 获取响应体字符串 + JSONObject tempResponseObject = JSONObject.parseObject(tempResponseBody); + if (tempResponseObject.get("code") != null && tempResponseObject.get("code").toString().equals("200")) { + List pList = JSONObject.parseArray(JSON.toJSON(tempResponseObject.get("data")).toString(), PageData.class); + //不是人员数 + if (pList.size()>0) { + PageData p = pList.get(0); + List psn = JSONArray.parseArray(p.get("psn").toString(), PageData.class); + pageData.put("pCount",psn.size()); + } + } + } + } + } else { + // 处理非成功状态码的情况 + System.out.println("Request failed with status code: " + response.getStatusCode()); + } + } + map.put("varList", varList); + map.put("result", errInfo); + System.out.println(response); + return map; + } +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/map/service/impl/UsersPositionServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/UsersPositionServiceImpl.java new file mode 100644 index 0000000..3249b71 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/map/service/impl/UsersPositionServiceImpl.java @@ -0,0 +1,290 @@ +package com.zcloud.modules.map.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.modules.map.service.UserPositionService; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.util.HttpRequestUtil; +import com.zcloud.util.PerLocUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; + +/** + * 说明:用户服务接口实现类 + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +@Service +@Transactional //开启事物 +public class UsersPositionServiceImpl implements UserPositionService { + @Autowired + private PerLocUtil perLocUtil; + + @Value("${perLoc.url}") + private String url; + + + @Override + public Object getCurrentLocation() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + String _response = HttpRequestUtil.doGetUser(url + "/deploy/psnmgt/getTheCurrentLocationOfAllEmployeesWhosePersonnelCardsAreOnline?office=", perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("data") != null) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("data")).toString(), PageData.class); + List varList = new ArrayList<>(); + if (!Objects.isNull(_varList)) { + for (PageData varData : _varList) { + List position = JSONObject.parseArray(JSON.toJSON(varData.get("coordinate")).toString(), String.class); + if (position != null) { + varData.put("LONGITUDE", position.get(0)); + varData.put("LATITUDE", position.get(1)); + } + varData.put("MAP_POINT_NAME", varData.getString("name")); + varData.put("NAME", varData.getString("name")); + varList.add(varData); + } + } + map.put("varList", varList); + } + } + map.put("result", errInfo); + return map; + } + + + @Override + public Object getCarCurrentLocation() throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + String _response = HttpRequestUtil.doGetUser(url + "/region/access/getCarRealLocationDataInfor", perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("list") != null) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("list")).toString(), PageData.class); + List varList = new ArrayList<>(); + if (!Objects.isNull(_varList)) { + for (PageData varData : _varList) { + varData.put("LONGITUDE", varData.get("flon")); + varData.put("LATITUDE", varData.get("flat")); + varData.put("MAP_POINT_NAME", varData.get("carsign")); + varData.put("NAME", varData.get("carsign")); + varList.add(varData); + } + } + map.put("varList", varList); + } + } + map.put("result", errInfo); + return map; + } + + /** + * 查询人员在线统计数据 + * + * @param + * @return + */ + @Override + public Object getCurrentPersonnelData(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route + "?office="; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("data") != null && StringUtils.isNotEmpty(response.get("data").toString())) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("data")).toString(), PageData.class); + PageData resultPd = new PageData(); + int internalPersonCount = 0; // 内部人员在线数量 + int outsourcingPersonCount = 0; // 外协人员在线数量 + int temporaryPersonCount = 0; // 临时人员在线数量 + if (!Objects.isNull(_varList)) { + for (PageData pageData : _varList) { + if ("内部员工".equals(pageData.getString("officeName"))) { // 内部员工 + internalPersonCount++; + continue; + } + if ("外协员工".equals(pageData.getString("officeName"))) { + outsourcingPersonCount++; + continue; + } + if ("临时员工".equals(pageData.getString("officeName"))) { + temporaryPersonCount++; + } + } + } + resultPd.put("onlinePersonCount", _varList.size()); + resultPd.put("internalPersonCount", internalPersonCount); + resultPd.put("outsourcingPersonCount", outsourcingPersonCount); + resultPd.put("temporaryPersonCount", temporaryPersonCount); + map.put("pd", resultPd); + } + + } + map.put("result", errInfo); + return map; + } + + /** + * 查询人员在线统计数据 + * + * @param + * @return + * @throws Exception + */ + @Override + public Object getCurrentCarData(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route + "?ftype=real"; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("list") != null && StringUtils.isNotEmpty(response.get("list").toString())) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("list")).toString(), PageData.class); + double onlineCarCount = 0; + for (PageData pageData : _varList) { + if (pageData.getString("psign").equals("一期堆场") || pageData.getString("psign").equals("二期堆场")) { + if (pageData.get("num") != null) { + BigDecimal bigDecimal = (BigDecimal) pageData.get("num"); + onlineCarCount += Double.parseDouble(bigDecimal.toString()); + } + } + } + PageData resultPd = new PageData(); + resultPd.put("onlineCarCount", onlineCarCount); + map.put("pd", resultPd); + } + + } + map.put("result", errInfo); + return map; + } + + + @Override + public Object getPersonPositioningStatistics(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("data")).toString(), PageData.class); + List varList = new ArrayList<>(); + if (!Objects.isNull(_varList)) { + for (PageData pageData : _varList) { + PageData data = new PageData(); + data.put("cardNo", pageData.getString("cardNo")); + data.put("name", pageData.getString("name")); + data.put("cardType", (boolean) pageData.get("cardType") ? "在线" : "离线"); + varList.add(data); + } + } + if (varList.size() > 8) { + map.put("varList", varList.subList(0, 8)); + } else { + map.put("varList", varList); + } + } + map.put("result", errInfo); + return map; + } + + + /** + * 获取车辆定位统计列表 + * + * @param route + * @return + * @throws Exception + */ + @Override + public Object getCarPositioningStatistics(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("list") != null) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("list")).toString(), PageData.class); + List varList = new ArrayList<>(); + if (!Objects.isNull(_varList)) { + for (PageData pageData : _varList) { + PageData data = new PageData(); + data.put("name", pageData.getString("carsign")); + varList.add(data); + } + } + if (varList.size() > 6) { + map.put("varList", varList.subList(0, 6)); + } else { + map.put("varList", varList); + } + } + + } + map.put("result", errInfo); + return map; + } + + + @Override + public Object getCurrentLocationCount() { + Map map = new HashMap(); + String errInfo = "success"; + + try { + String _response = HttpRequestUtil.doGetUser(url + "/deploy/psnmgt/getTheCurrentLocationOfAllEmployeesWhosePersonnelCardsAreOnline?office=", perLocUtil.getToken()); + map.put("perCount", 0); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("data") != null) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("data")).toString(), PageData.class); + map.put("perCount", _varList.size()); + } + } + map.put("result", errInfo); + } catch (Exception e) { + map.put("result", "error"); + map.put("msg", "第三方登录失败"); + + } + + return map; + + + } + + + + @Override + public Object getDianZiWeiLanList(String route) throws Exception { + Map map = new HashMap<>(); + String errInfo = "success"; + String path = url + route; + String _response = HttpRequestUtil.doGetUser(path, perLocUtil.getToken()); + if (StringUtils.isNotEmpty(_response)) { + JSONObject response = JSONObject.parseObject(_response); + if (response.get("rows") != null) { + List _varList = JSONObject.parseArray(JSON.toJSON(response.get("rows")).toString(), PageData.class); + map.put("varList", _varList); + } + } + map.put("result", errInfo); + return map; + } + + +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/controller/MkmjDoorController.java b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/controller/MkmjDoorController.java new file mode 100644 index 0000000..cb8c6a3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/controller/MkmjDoorController.java @@ -0,0 +1 @@ +package com.zcloud.modules.mkmjDoor.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/entity/MkmjDoorEntity.java b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/entity/MkmjDoorEntity.java new file mode 100644 index 0000000..4c9cdbb --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/entity/MkmjDoorEntity.java @@ -0,0 +1,107 @@ +package com.zcloud.modules.mkmjDoor.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.Date; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("mkmj_door") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class MkmjDoorEntity { + /** + * 主键 + */ + @TableId(value = "DOOR_ID",type = IdType.AUTO) + @TableField(value = "DOOR_ID") + @JsonProperty(value = "DOOR_ID") + private String doorId; + /** + * 对接来源数据ID + */ + @TableField(value = "SOURCE_ID") + @JsonProperty(value = "SOURCE_ID") + private String sourceId; + /** + * 所属区域 + */ + @TableField(value = "AREA_ID") + @JsonProperty(value = "AREA_ID") + private String areaId; + /** + * 口门名称(文本框、自定义输入) + */ + @TableField(value = "DOOR_NAME") + @JsonProperty(value = "DOOR_NAME") + private String doorName; + /** + * 口门类型(0 车行口门、1 人行口门、2 综合口门) + */ + @TableField(value = "DOOR_TYPE") + @JsonProperty(value = "DOOR_TYPE") + private Integer dooreType; + /** + * 状态(0正常、1停用、2暂时关闭) + */ + @TableField(value = "STATUS") + @JsonProperty(value = "STATUS") + private Integer STATUS; + /** + * 所属企业ID + */ + @TableField(value = "CORPINFO_ID") + @JsonProperty(value = "CORPINFO_ID") + private String corpinfoId; + /** + * 创建人 + */ + @TableField(value = "CREATOR") + @JsonProperty(value = "CREATOR") + private String CREATOR; + /** + * 创建时间 + */ + @TableField(value = "CREATTIME") + @JsonProperty(value = "CREATTIME") + private String CREATTIME; + /** + * 修改人 + */ + @TableField(value = "OPERATOR") + @JsonProperty(value = "OPERATOR") + private String OPERATOR; + /** + * 修改时间 + */ + @TableField(value = "OPERATTIME") + @JsonProperty(value = "OPERATTIME") + private String OPERATTIME; + /** + * 经度 + */ + @TableField(value = "LONGITUDE") + @JsonProperty(value = "LONGITUDE") + private String LONGITUDE; + /** + * 纬度 + */ + @TableField(value = "LATITUDE") + @JsonProperty(value = "LATITUDE") + private String LATITUDE; + /** + * 是 1 否 0 删除 + */ + @TableField(value = "ISDELETE") + @JsonProperty(value = "ISDELETE") + private String ISDELETE; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/mapper/MkmjDoorMapper.java b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/mapper/MkmjDoorMapper.java new file mode 100644 index 0000000..1ca1a10 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/mapper/MkmjDoorMapper.java @@ -0,0 +1,16 @@ +package com.zcloud.modules.mkmjDoor.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.mkmjDoor.entity.MkmjDoorEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface MkmjDoorMapper extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/service/MkmjDoorService.java b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/service/MkmjDoorService.java new file mode 100644 index 0000000..e0a26c0 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/service/MkmjDoorService.java @@ -0,0 +1,14 @@ +package com.zcloud.modules.mkmjDoor.service; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.mkmjDoor.entity.MkmjDoorEntity; + + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface MkmjDoorService extends IService { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/service/impl/MkmjDoorServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/service/impl/MkmjDoorServiceImpl.java new file mode 100644 index 0000000..b34b3ed --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/mkmjDoor/service/impl/MkmjDoorServiceImpl.java @@ -0,0 +1,20 @@ +package com.zcloud.modules.mkmjDoor.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.mkmjDoor.entity.MkmjDoorEntity; +import com.zcloud.modules.mkmjDoor.mapper.MkmjDoorMapper; +import com.zcloud.modules.mkmjDoor.service.MkmjDoorService; +import org.springframework.stereotype.Service; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class MkmjDoorServiceImpl extends ServiceImpl implements MkmjDoorService { + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/personLocationToken/controller/PersonLocationTokenController.java b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/controller/PersonLocationTokenController.java new file mode 100644 index 0000000..40389a8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/controller/PersonLocationTokenController.java @@ -0,0 +1 @@ +package com.zcloud.modules.personLocationToken.controller; diff --git a/review_repo/src/main/java/com/zcloud/modules/personLocationToken/entity/PersonLocationTokenEntity.java b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/entity/PersonLocationTokenEntity.java new file mode 100644 index 0000000..72879a3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/entity/PersonLocationTokenEntity.java @@ -0,0 +1,29 @@ +package com.zcloud.modules.personLocationToken.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.Date; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Data +@TableName("bus_person_location_token") +@EqualsAndHashCode(callSuper = false) +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class PersonLocationTokenEntity { + /** + * + */ + @TableId(value = "TOKEN",type = IdType.AUTO) + @TableField(value = "TOKEN") + @JsonProperty(value = "TOKEN") + private String TOKEN; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/personLocationToken/mapper/PersonLocationTokenMapper.java b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/mapper/PersonLocationTokenMapper.java new file mode 100644 index 0000000..4ac923d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/mapper/PersonLocationTokenMapper.java @@ -0,0 +1,25 @@ +package com.zcloud.modules.personLocationToken.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.personLocationToken.entity.PersonLocationTokenEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Mapper +public interface PersonLocationTokenMapper extends BaseMapper { + + /**修改 + * @throws Exception + */ + void edit(String token); + + /** + * @throws Exception + */ + String getToken(); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/personLocationToken/service/PersonLocationTokenService.java b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/service/PersonLocationTokenService.java new file mode 100644 index 0000000..cd7ced3 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/service/PersonLocationTokenService.java @@ -0,0 +1,13 @@ +package com.zcloud.modules.personLocationToken.service; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.personLocationToken.entity.PersonLocationTokenEntity; + +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +public interface PersonLocationTokenService extends IService { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/personLocationToken/service/impl/PersonLocationTokenServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/service/impl/PersonLocationTokenServiceImpl.java new file mode 100644 index 0000000..e9088ba --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/personLocationToken/service/impl/PersonLocationTokenServiceImpl.java @@ -0,0 +1,22 @@ +package com.zcloud.modules.personLocationToken.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.personLocationToken.entity.PersonLocationTokenEntity; +import com.zcloud.modules.personLocationToken.mapper.PersonLocationTokenMapper; +import com.zcloud.modules.personLocationToken.service.PersonLocationTokenService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +/** + * + * + * @author Mark + * @since 1.0.0 2025-03-31 + */ +@Service +public class PersonLocationTokenServiceImpl extends ServiceImpl implements PersonLocationTokenService { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/AbstractController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/AbstractController.java new file mode 100644 index 0000000..8fec701 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/AbstractController.java @@ -0,0 +1,32 @@ +package com.zcloud.modules.sys.controller; + +import com.zcloud.modules.sys.entity.SysUserEntity; +import org.apache.shiro.SecurityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.UUID; + +/** + * Controller公共组件 + */ +public abstract class AbstractController { + protected Logger logger = LoggerFactory.getLogger(getClass()); + + protected SysUserEntity getUser() { + return (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); + } + + protected String getUserId() { + return getUser().getUserId(); + } + + protected String getUsername() { + return getUser().getUsername(); + } + + protected String get32UUID() { + String uuid = UUID.randomUUID().toString().trim().replaceAll("-", ""); + return uuid; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/BusImgfilesController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/BusImgfilesController.java new file mode 100644 index 0000000..5aa0a45 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/BusImgfilesController.java @@ -0,0 +1,81 @@ +package com.zcloud.modules.sys.controller; + +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.BusImgfilesEntity; +import com.zcloud.modules.sys.service.BusImgfilesService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import java.util.Map; + +/** + * @Author fangjiakai + * @Desc 图片附件(BusImgfiles)表控制层 + * @Date 2023-10-19 15:09:20 + */ +@Api(tags = "图片附件") +@RestController +@RequestMapping("busImgfiles") +public class BusImgfilesController extends AbstractController { + + @Autowired + private BusImgfilesService busImgfilesService; + + @ApiOperation("图片附件-新增数据") + @SysLog("图片附件-新增数据") +// @RequiresPermissions("BusImgfiles:save") + @PostMapping("/save") + public R insert(@RequestBody BusImgfilesEntity param) { + busImgfilesService.save(param); + + return R.ok(); + } + + @ApiOperation("图片附件-编辑数据") + @SysLog("图片附件-编辑数据") +// @RequiresPermissions("BusImgfiles:update") + @PostMapping("/update") + public R update(@RequestBody BusImgfilesEntity param) { + busImgfilesService.updateById(param); + + return R.ok(); + } + + + @ApiOperation("图片附件-删除数据") + @SysLog("图片附件-删除数据") +// @RequiresPermissions("BusImgfiles:delete") + @PostMapping("/delete") + public R delete(@RequestBody BusImgfilesEntity param) { + busImgfilesService.delete(param.getImgfilesId()); + return R.ok(); + } + + @ApiOperation("图片附件-分页查询") + @SysLog("图片附件-分页查询") +// @RequiresPermissions("BusImgfiles:list") + @PostMapping("/listPage") + public R listPage(@RequestBody Map params) { + PageUtils page = busImgfilesService.listPage(params); + + return R.ok().put("page", page); + } + + + @ApiOperation("图片附件-根据ID查详情") + @SysLog("图片附件-根据ID查详情") +// @RequiresPermissions("BusImgfiles:info") + @PostMapping("/info") + public R info(@RequestBody BusImgfilesEntity param) { + BusImgfilesEntity busImgfiles = busImgfilesService.getById(param.getImgfilesId()); + return R.ok().put("busImgfiles", busImgfiles); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysConfigController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysConfigController.java new file mode 100644 index 0000000..93d106c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysConfigController.java @@ -0,0 +1,91 @@ + + +package com.zcloud.modules.sys.controller; + + +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.common.validator.ValidatorUtils; +import com.zcloud.modules.sys.entity.SysConfigEntity; +import com.zcloud.modules.sys.service.SysConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * 系统配置信息 + * + * + */ +@RestController +@RequestMapping("/sys/config") +public class SysConfigController extends AbstractController { + @Autowired + private SysConfigService sysConfigService; + + /** + * 所有配置列表 + */ + @PostMapping("/list") + //@RequiresPermission("sys:config:list") + public R list(@RequestBody Map params){ + PageUtils page = sysConfigService.queryPage(params); + + return R.ok().put("page", page); + } + + + /** + * 配置信息 + */ + @PostMapping("/info/{id}") + //@RequiresPermission("sys:config:info") + public R info(@PathVariable("id") String id){ + SysConfigEntity config = sysConfigService.getById(id); + + return R.ok().put("config", config); + } + + /** + * 保存配置 + */ + @SysLog("保存配置") + @PostMapping("/save") + //@RequiresPermission("sys:config:save") + public R save(@RequestBody SysConfigEntity config){ + ValidatorUtils.validateEntity(config); + + sysConfigService.saveConfig(config); + + return R.ok(); + } + + /** + * 修改配置 + */ + @SysLog("修改配置") + @PostMapping("/update") + //@RequiresPermission("sys:config:update") + public R update(@RequestBody SysConfigEntity config){ + ValidatorUtils.validateEntity(config); + + sysConfigService.update(config); + + return R.ok(); + } + + /** + * 删除配置 + */ + @SysLog("删除配置") + @PostMapping("/delete") + //@RequiresPermission("sys:config:delete") + public R delete(@RequestBody String[] ids){ + sysConfigService.deleteBatch(ids); + + return R.ok(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysDictionariesController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysDictionariesController.java new file mode 100644 index 0000000..1d99bce --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysDictionariesController.java @@ -0,0 +1,131 @@ +package com.zcloud.modules.sys.controller; + +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.SysDictionariesEntity; +import com.zcloud.modules.sys.service.SysDictionariesService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 数据字典管理 + * + */ +@RestController +@RequestMapping("/sys/dictionaries") +@Api(tags="数据字典管理") +public class SysDictionariesController extends AbstractController { + @Autowired + private SysDictionariesService sysDictionariesService; + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermission("sys:dictionaries:save") + @ApiOperation(value = "保存字典") + public R save(@RequestBody SysDictionariesEntity dictionaries){ + + sysDictionariesService.save(dictionaries); + + return R.ok(); + } + + /** + * 修改 + */ + @PostMapping("/update") + //@RequiresPermission("sys:dictionaries:update") + @ApiOperation(value = "修改字典") + public R update(@RequestBody SysDictionariesEntity dictionaries){ + + sysDictionariesService.updateById(dictionaries); + + return R.ok(); + } + + /** + * 删除 + */ + @PostMapping("/delete") + //@RequiresPermission("sys:dictionaries:delete") + @ApiOperation(value = "删除字典") + public R delete(@RequestBody SysDictionariesEntity dictionaries){ + //判断是否有下级字典 + List dictionariesList = sysDictionariesService.queryListParentId(dictionaries.getDictionariesId()); + if(dictionariesList.size() > 0){ + return R.error(200,"请先删除下级字典"); + } + + sysDictionariesService.delete(dictionaries.getDictionariesId()); + + return R.ok(); + } + + /** + * 所有字典列表 + */ + @PostMapping("/findByBianma") + @ApiOperation(value = "按编码查询") + public R findByBianma(@RequestBody SysDictionariesEntity dictionaries){ + dictionaries = sysDictionariesService.queryByBianma(dictionaries.getBianma()); + return R.ok().put("dictionaries", dictionaries); + } + + /** + * 分页字典列表 + */ + @GetMapping("/listPage") + //@RequiresPermission("sys:dictionaries:list") + @ApiOperation(value = "分页查询字典列表") + public R listPage(Map params){ + + PageUtils page = sysDictionariesService.queryPage(params); + + return R.ok().put("page", page); + } + + /** + * 查询字典列表 + */ + @PostMapping("/list") + //@RequiresPermission("sys:dictionaries:list") + @ApiOperation(value = "查询字典列表") + public R list(@RequestBody SysDictionariesEntity dictionaries){ + List dictionariesList = sysDictionariesService.queryListParentId(dictionaries.getParentId()); + + return R.ok().put("dictionariesList", dictionariesList); + } + + /** + * 查询字典列表(树) + */ + @PostMapping("/listTree") + //@RequiresPermission("sys:dictionaries:list") + @ApiOperation(value = "查询字典列表(树)") + public R listTree(@RequestBody SysDictionariesEntity dictionaries){ + List dictionariesList = sysDictionariesService.getAllList(dictionaries.getParentId()); + + return R.ok().put("dictionariesList", dictionariesList); + } + + /** + * 字典信息 + */ + @PostMapping("/info") + //@RequiresPermission("sys:dictionaries:info") + @ApiOperation(value = "查看字典详情") + public R info( + @ApiParam(name = "dictionariesId", value = "主键", required = true) @RequestBody SysDictionariesEntity dictionaries){ + dictionaries = sysDictionariesService.getById(dictionaries.getDictionariesId()); + return R.ok().put("dictionaries", dictionaries); + } +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysLogController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysLogController.java new file mode 100644 index 0000000..772a75c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysLogController.java @@ -0,0 +1,41 @@ + + +package com.zcloud.modules.sys.controller; + +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.service.SysLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +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.ResponseBody; + +import java.util.Map; + + +/** + * 系统日志 + * + * + */ +@Controller +@RequestMapping("/sys/log") +public class SysLogController { + @Autowired + private SysLogService sysLogService; + + /** + * 列表 + */ + @ResponseBody + @PostMapping("/list") + //@RequiresPermission("sys:log:list") + public R list(@RequestBody Map params){ + PageUtils page = sysLogService.queryPage(params); + + return R.ok().put("page", page); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysLoginController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysLoginController.java new file mode 100644 index 0000000..962c5a9 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysLoginController.java @@ -0,0 +1,103 @@ +package com.zcloud.modules.sys.controller; + +import cn.hutool.core.util.StrUtil; +import com.zcloud.common.utils.AesEncryptor; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.SysDictionariesEntity; +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.form.SysLoginForm; +import com.zcloud.modules.sys.service.SysCaptchaService; +import com.zcloud.modules.sys.service.SysUserService; +import com.zcloud.modules.sys.service.SysUserTokenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.io.IOUtils; +import org.apache.shiro.crypto.hash.Sha256Hash; +import org.apache.shiro.crypto.hash.SimpleHash; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.imageio.ImageIO; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Map; + +/** + * 登录相关 + */ +@RestController +@Api(tags = "登录接口") +public class SysLoginController extends AbstractController { + @Autowired + private SysUserService sysUserService; + @Autowired + private SysCaptchaService sysCaptchaService; + @Autowired + private SysUserTokenService sysUserTokenService; + + /** + * 验证码 + */ + @PostMapping("captcha.jpg") + public void captcha(HttpServletResponse response, String uuid) throws IOException { + response.setHeader("Cache-Control", "no-store, no-cache"); + response.setContentType("image/jpeg"); + + //获取图片验证码 + BufferedImage image = sysCaptchaService.getCaptcha(uuid); + + ServletOutputStream out = response.getOutputStream(); + ImageIO.write(image, "jpg", out); + IOUtils.closeQuietly(out); + } + + @PostMapping("/sys/login") + @ApiOperation("登录") + public Map login(@RequestBody SysLoginForm form) throws IOException { +// boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha()); +// if(!captcha){ +// return R.error("验证码不正确"); +// } + //密码解密 + String decryptUsername = AesEncryptor.aesDecrypt(form.getUsername()); + String decryptPassword = AesEncryptor.aesDecrypt(form.getPassword()); + + //用户信息 + SysUserEntity user = sysUserService.queryByUserName(decryptUsername); + //账号不存在、密码错误 + if (user == null || !user.getPassword().equals(new SimpleHash("SHA-1", decryptUsername, decryptPassword).toString())) { + return R.error(200, "账号或密码不正确"); + } + //生成token,并保存到数据库 + R r = sysUserTokenService.createToken(user.getUserId()); + return r; + } + + /** + * 退出 + */ + @PostMapping("/sys/logout") + @ApiOperation("退出登录") + public R logout() { + sysUserTokenService.logout(getUserId()); + return R.ok(); + } + + /** + * 刷新token + */ + @PostMapping("/sys/refreshToken") + @ApiOperation("刷新token") + public R refreshToken() { + sysUserTokenService.refreshToken(getUserId()); + return R.ok(); + } + + public static void main(String[] args) { + System.out.println(new Sha256Hash("666666", "999999aA")); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysMenuController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysMenuController.java new file mode 100644 index 0000000..edb0724 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysMenuController.java @@ -0,0 +1,144 @@ +package com.zcloud.modules.sys.controller; + +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.SysMenuEntity; +import com.zcloud.modules.sys.service.ShiroService; +import com.zcloud.modules.sys.service.SysMenuService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import java.util.List; +import java.util.Set; + + +/** + * 系统菜单 + * + * + */ +@RestController +@RequestMapping("/sys/menu") +@Api(tags="菜单管理") +public class SysMenuController extends AbstractController { + @Autowired + private SysMenuService sysMenuService; + @Autowired + private ShiroService shiroService; + + + /** + * 导航菜单 + */ + @PostMapping("/nav") + @ApiOperation(value = "获取导航") + public R nav(){ + List menuList = sysMenuService.getUserMenuList(getUserId()); + Set permissions = shiroService.getUserPermissions(getUserId()); + return R.ok().put("menuList", menuList).put("permissions", permissions); + } + + /** + * 所有菜单列表 + */ + @PostMapping("/list") + //@RequiresPermission("sys:menu:list") + @ApiOperation(value = "所有菜单列表") + public R list(@RequestBody SysMenuEntity menu){ + List list = sysMenuService.getAllList(menu.getParentId()); + + return R.ok().put("menuList", list); + } + + /** + * 所有菜单列表(不包括按钮) + */ + @PostMapping("/listNotButton") + //@RequiresPermission("sys:menu:select") + @ApiOperation(value = "所有菜单列表(不包括按钮)") + public R listNotButton(@RequestBody SysMenuEntity menu){ + List list = sysMenuService.getAllListNotButton(menu.getParentId()); + + return R.ok().put("menuList", list); + } + + /** + * 菜单信息 + */ + @PostMapping("/info") + //@RequiresPermission("sys:menu:info") + @ApiOperation(value = "菜单信息") + public R info(@RequestBody SysMenuEntity menu){ + menu = sysMenuService.getById(menu.getMenuId()); + if (menu.getParentId()!=0){ + menu.setParentName(sysMenuService.getById(menu.getParentId()).getName()); + } + return R.ok().put("menu", menu); + } + + /** + * 保存 + */ + @SysLog("保存菜单") + @PostMapping("/save") + //@RequiresPermission("sys:menu:save") + @ApiOperation(value = "保存菜单信息") + public R save(@RequestBody SysMenuEntity menu){ + + sysMenuService.save(menu); + + return R.ok(); + } + + /** + * 修改 + */ + @SysLog("修改菜单") + @PostMapping("/update") + //@RequiresPermission("sys:menu:update") + @ApiOperation(value = "修改菜单信息") + public R update(@RequestBody SysMenuEntity menu){ + + sysMenuService.updateById(menu); + + return R.ok(); + } + + /** + * 修改菜单图标 + */ + @SysLog("修改菜单图标") + @PostMapping("/icon") + //@RequiresPermission("sys:menu:update") + @ApiOperation(value = "修改菜单图标") + public R icon(@RequestBody SysMenuEntity menu){ + sysMenuService.updateById(menu); + + return R.ok(); + } + + /** + * 删除 + */ + @SysLog("删除菜单") + @PostMapping("/delete") + //@RequiresPermission("sys:menu:delete") + @ApiOperation(value = "删除菜单信息") + public R delete(@RequestBody SysMenuEntity menu){ + //判断是否有子菜单或按钮 + List menuList = sysMenuService.queryListParentId(menu.getMenuId()); + if(menuList.size() > 0){ + return R.error(200,"请先删除子菜单或按钮"); + } + + sysMenuService.delete(menu.getMenuId()); + + return R.ok(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysRoleController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysRoleController.java new file mode 100644 index 0000000..f25ba5a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysRoleController.java @@ -0,0 +1,116 @@ + + +package com.zcloud.modules.sys.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.SysRoleEntity; +import com.zcloud.modules.sys.service.SysRoleMenuService; +import com.zcloud.modules.sys.service.SysRoleService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import java.util.List; +import java.util.Map; + +/** + * 角色管理 + * + */ +@Api(tags = "角色") +@RestController +@RequestMapping("/sys/role") +public class SysRoleController extends AbstractController { + @Autowired + private SysRoleService sysRoleService; + @Autowired + private SysRoleMenuService sysRoleMenuService; + + /** + * 角色列表 + */ + @ApiOperation("角色-分页查询") + @PostMapping("/listPage") + //@RequiresPermission("sys:role:list") + public R listPage(@RequestBody Map params){ + PageUtils page = sysRoleService.queryPage(params); + + return R.ok().put("page", page); + } + + @ApiOperation("角色-查询全部") + @SysLog("角色-查询全部") + @PostMapping("/listAll") + public R listAll(@RequestBody Map params) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type", 1); + queryWrapper.orderByDesc("create_time"); + List list = sysRoleService.list(queryWrapper); + return R.ok().put("roleList", list); + } + + /** + * 角色信息 + */ + @ApiOperation("角色-根据ID查详情") + @PostMapping("/info") + //@RequiresPermission("sys:role:info") + public R info(@RequestBody SysRoleEntity role){ + role = sysRoleService.getById(role.getRoleId()); + + //查询角色对应的菜单 + List menuIdList = sysRoleMenuService.queryMenuIdList(role.getRoleId()); + role.setMenuIdList(menuIdList); + + return R.ok().put("role", role); + } + + /** + * 保存角色 + */ + @ApiOperation("角色-新增数据") + @SysLog("保存角色") + @PostMapping("/save") + //@RequiresPermission("sys:role:save") + public R save(@RequestBody SysRoleEntity role){ + role.setCreator(getUserId()); + sysRoleService.saveRole(role); + + return R.ok(); + } + + /** + * 修改角色 + */ + @ApiOperation("角色-编辑数据") + @SysLog("修改角色") + @PostMapping("/update") + //@RequiresPermission("sys:role:update") + public R update(@RequestBody SysRoleEntity role){ + + role.setCreator(getUserId()); + sysRoleService.update(role); + + return R.ok(); + } + + /** + * 删除角色 + */ + @ApiOperation("角色-删除数据") + @SysLog("删除角色") + @PostMapping("/delete") + //@RequiresPermission("sys:role:delete") + public R delete(@RequestBody SysRoleEntity role){ + sysRoleService.deleteBatch(role.getRoleIds()); + + return R.ok(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysUserController.java b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysUserController.java new file mode 100644 index 0000000..3c63c9f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/controller/SysUserController.java @@ -0,0 +1,183 @@ + + +package com.zcloud.modules.sys.controller; + +import com.zcloud.common.annotation.SysLog; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.common.validator.Assert; +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.form.PasswordForm; +import com.zcloud.modules.sys.service.SysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang.ArrayUtils; +import org.apache.shiro.crypto.hash.Sha256Hash; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import java.util.List; +import java.util.Map; + +/** + * 系统用户 + */ +@RestController +@RequestMapping("/sys/user") +@Api(tags = "用户管理") +public class SysUserController extends AbstractController { + @Autowired + private SysUserService sysUserService; + + + /** + * 用户分页列表 + */ + @PostMapping("/list") + //@RequiresPermission("sys:user:list") + @ApiOperation(value = "用户分页列表") + public R list(@RequestBody Map params) { + PageUtils page = sysUserService.queryPage(params); + + return R.ok().put("page", page); + } + + /** + * 所有用户列表(不分页) + */ + @PostMapping("/listAll") + @ApiOperation(value = "所有用户列表") + public R listAll(@RequestBody Map params) { + params.put("isDelete", 0); + List list = sysUserService.listAll(params); + return R.ok().put("data", list); + } + + /** + * 下拉用户列表(不分页) + */ + @PostMapping("/listForSelect") + @ApiOperation(value = "下拉用户列表") + public R listForSelect(@RequestBody Map params) { + List list = sysUserService.listForSelect(params); + return R.ok().put("userList", list); + } + + /** + * 获取登录的用户信息 + */ + @PostMapping("/info") + @ApiOperation(value = "获取登录的用户信息") + public R info() { + return R.ok().put("user", getUser()); + } + + /** + * 修改登录用户密码 + */ + @SysLog("修改登录用户密码") + @PostMapping("/password") + @ApiOperation(value = "修改登录用户密码") + public R password(@RequestBody PasswordForm form) { + Assert.isBlank(form.getNewPassword(), "新密码不为能空"); + + //sha256加密 + String password = new Sha256Hash(form.getPassword(), getUsername()).toString(); + //sha256加密 + String newPassword = new Sha256Hash(form.getNewPassword(), getUsername()).toString(); + + //更新密码 + boolean flag = sysUserService.updatePassword(getUserId(), password, newPassword); + if (!flag) { + return R.error(200, "原密码不正确"); + } + + return R.ok(); + } + + /** + * 用户信息 + */ + @PostMapping("/getInfo") + //@RequiresPermission("sys:user:info") + @ApiOperation(value = "获取用户信息") + public R info(@RequestBody SysUserEntity user) { + user = sysUserService.queryById(user.getUserId()); + + return R.ok().put("user", user); + } + + /** + * 查询用户是否存在 + */ + @PostMapping("/hasUser") + @ApiOperation(value = "查询用户是否存在") + public R hasUser(@RequestBody SysUserEntity user) { + user = sysUserService.queryByUserName(user.getUsername()); + return R.ok().put("user", user); + } + + /** + * 保存用户 + */ + @SysLog("保存用户") + @PostMapping("/save") + //@RequiresPermission("sys:user:save") + @ApiOperation(value = "保存用户") + public R save(@RequestBody SysUserEntity user) { + user.setCreator(getUserId()); + sysUserService.saveUser(user); + + return R.ok(); + } + + /** + * 修改用户 + */ + @SysLog("修改用户") + @PostMapping("/update") + //@RequiresPermission("sys:user:update") + @ApiOperation(value = "修改用户") + public R update(@RequestBody SysUserEntity user) { + sysUserService.update(user); + return R.ok(); + } + + /** + * 删除用户 + */ + @SysLog("删除用户") + @PostMapping("/delete") + //@RequiresPermission("sys:user:delete") + @ApiOperation(value = "删除用户") + public R delete(@RequestBody SysUserEntity user) { + if (ArrayUtils.contains(user.getUserIds(), 1L)) { + return R.error(200, "系统管理员不能删除"); + } + + if (ArrayUtils.contains(user.getUserIds(), getUserId())) { + return R.error(200, "当前用户不能删除"); + } + return R.ok(); + } + + /** + * 重置用户密码 + */ + @SysLog("重置用户密码") + @PostMapping("/resetPassword") + @ApiOperation(value = "重置用户密码") + public R resetPassword(@RequestBody SysUserEntity user) { + user = sysUserService.getById(user.getUserId()); + + //更新密码 + sysUserService.update(user); + + return R.ok(); + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/BusImgfilesDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/BusImgfilesDao.java new file mode 100644 index 0000000..ffdfebf --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/BusImgfilesDao.java @@ -0,0 +1,23 @@ +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zcloud.modules.sys.entity.BusImgfilesEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Map; +/** + * @Author fangjiakai + * @Desc 图片附件(BusImgfiles)表数据库访问层 + * @Date 2023-10-19 15:09:20 + */ +@Mapper +public interface BusImgfilesDao extends BaseMapper { + + /** + * 分页查询 + */ + IPage> listPage(@Param("page") Page> page,@Param("params") Map params); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysCaptchaDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysCaptchaDao.java new file mode 100644 index 0000000..ac9b429 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysCaptchaDao.java @@ -0,0 +1,17 @@ + + +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysCaptchaEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 验证码 + * + * + */ +@Mapper +public interface SysCaptchaDao extends BaseMapper { + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysConfigDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysConfigDao.java new file mode 100644 index 0000000..1202ec6 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysConfigDao.java @@ -0,0 +1,29 @@ + + +package com.zcloud.modules.sys.dao; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysConfigEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 系统配置信息 + * + * + */ +@Mapper +public interface SysConfigDao extends BaseMapper { + + /** + * 根据key,查询value + */ + SysConfigEntity queryByKey(String paramKey); + + /** + * 根据key,更新value + */ + int updateValueByKey(@Param("paramKey") String paramKey, @Param("paramValue") String paramValue); + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysDictionariesDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysDictionariesDao.java new file mode 100644 index 0000000..7fc08aa --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysDictionariesDao.java @@ -0,0 +1,24 @@ +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysDictionariesEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 菜单管理 + * + * + */ +@Mapper +public interface SysDictionariesDao extends BaseMapper { + + /** + * 根据父菜单,查询子菜单 + * @param parentId 父菜单ID + */ + List queryListParentId(String parentId); + + String getRecurrenceIds(String id); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysLogDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysLogDao.java new file mode 100644 index 0000000..33b9e32 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysLogDao.java @@ -0,0 +1,23 @@ + + +package com.zcloud.modules.sys.dao; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysLogEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统日志 + * + * + */ +@Mapper +public interface SysLogDao extends BaseMapper { + + boolean existsTable(String tableName); + + void createTable(String tableName); + + void insertIntoTable(SysLogEntity logEntity, String tableName); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysMenuDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysMenuDao.java new file mode 100644 index 0000000..6391289 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysMenuDao.java @@ -0,0 +1,30 @@ + + +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysMenuEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 菜单管理 + * + * + */ +@Mapper +public interface SysMenuDao extends BaseMapper { + + /** + * 根据父菜单,查询子菜单 + * @param parentId 父菜单ID + */ + List queryListParentId(Integer parentId); + + /** + * 获取不包含按钮的菜单列表 + */ + List queryNotButtonList(Integer parentId); + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysRoleDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysRoleDao.java new file mode 100644 index 0000000..763ec4f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysRoleDao.java @@ -0,0 +1,23 @@ + + +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysRoleEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 角色管理 + * + * + */ +@Mapper +public interface SysRoleDao extends BaseMapper { + + /** + * 查询用户创建的角色ID列表 + */ + List queryRoleIdList(String createUserId); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysRoleMenuDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysRoleMenuDao.java new file mode 100644 index 0000000..00c5ffb --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysRoleMenuDao.java @@ -0,0 +1,28 @@ + + +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysRoleMenuEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 角色与菜单对应关系 + * + * + */ +@Mapper +public interface SysRoleMenuDao extends BaseMapper { + + /** + * 根据角色ID,获取菜单ID列表 + */ + List queryMenuIdList(String roleId); + + /** + * 根据角色ID数组,批量删除 + */ + int deleteBatch(String[] roleIds); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserDao.java new file mode 100644 index 0000000..1879988 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserDao.java @@ -0,0 +1,55 @@ +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.modules.sys.entity.SysUserEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 系统用户 + * + * + */ +@Mapper +public interface SysUserDao extends BaseMapper { + + SysUserEntity queryById(String userId); + + /** + * 查询用户的所有权限 + * @param userId 用户ID + */ + List queryAllPerms(String userId); + + /** + * 查询用户的所有菜单ID + */ + List queryAllMenuId(String userId); + + /** + * 根据用户名,查询系统用户 + */ + SysUserEntity queryByUserName(String username); + + /** + * 分页查询 + */ + IPage listPage(Page> page, Map params); + + /** + * 查询全部用户 + */ + List listAll(Map params); + + /** + * 实业地图使用 根据工号查询 + * @param pd + * @return + */ + PageData findByCardNo(PageData pd); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserRoleDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserRoleDao.java new file mode 100644 index 0000000..35b0848 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserRoleDao.java @@ -0,0 +1,29 @@ + + +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysUserRoleEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 用户与角色对应关系 + * + * + */ +@Mapper +public interface SysUserRoleDao extends BaseMapper { + + /** + * 根据用户ID,获取角色ID列表 + */ + List queryRoleIdList(String userId); + + + /** + * 根据角色ID数组,批量删除 + */ + int deleteBatch(String[] roleIds); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserTokenDao.java b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserTokenDao.java new file mode 100644 index 0000000..e396a6c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/dao/SysUserTokenDao.java @@ -0,0 +1,18 @@ + + +package com.zcloud.modules.sys.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zcloud.modules.sys.entity.SysUserTokenEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统用户Token + * + */ +@Mapper +public interface SysUserTokenDao extends BaseMapper { + + SysUserTokenEntity queryByToken(String token); + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/BusImgfilesEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/BusImgfilesEntity.java new file mode 100644 index 0000000..98ff1e2 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/BusImgfilesEntity.java @@ -0,0 +1,38 @@ +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author fangjiakai + * @Desc 图片附件(BusImgfiles)实体 + * @Date 2023-10-19 15:09:20 + */ +@Data +@TableName("bus_imgfiles") +public class BusImgfilesEntity implements Serializable { + private static final long serialVersionUID = 198859459889538527L; + @TableId + private String imgfilesId; + //路径 + @ApiModelProperty(value = "路径") + private String filepath; + // 文件名 + @ApiModelProperty(value = "文件名") + private String filename; + //类型 1营业执照 + @ApiModelProperty(value = "类型 1营业执照") + private Integer type; + //外键 + @ApiModelProperty(value = "外键") + private String foreignKey; + //企业ID + @ApiModelProperty(value = "企业ID") + private String corpinfoId; + +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/PageData.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/PageData.java new file mode 100644 index 0000000..cbd1e0b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/PageData.java @@ -0,0 +1,144 @@ +package com.zcloud.modules.sys.entity; + +import com.alibaba.druid.proxy.jdbc.ClobProxyImpl; +import org.apache.ibatis.type.Alias; + +import javax.servlet.http.HttpServletRequest; +import java.io.BufferedReader; +import java.io.Reader; +import java.util.*; + +/** + * 说明:参数封装Map + + + */ +@Alias("pd") +public class PageData extends HashMap implements Map { + + private static final long serialVersionUID = 1L; + + Map map = null; + HttpServletRequest request; + + public PageData(HttpServletRequest request) { + this.request = request; + Map properties = request.getParameterMap(); + Map returnMap = new HashMap(); + Iterator entries = properties.entrySet().iterator(); + Entry entry; + String name = ""; + String value = ""; + while (entries.hasNext()) { + entry = (Entry) entries.next(); + name = (String) entry.getKey(); + Object valueObj = entry.getValue(); + if (null == valueObj) { + value = ""; + } else if (valueObj instanceof String[]) { + String[] values = (String[]) valueObj; + for (int i = 0; i < values.length; i++) { + value = values[i] + ","; + } + value = value.substring(0, value.length() - 1); + } else { + value = valueObj.toString(); + } + returnMap.put(name, value); + } + map = returnMap; + } + + public PageData() { + map = new HashMap(); + } + + @Override + public Object get(Object key) { + Object obj = null; + if (map.get(key) instanceof Object[]) { + Object[] arr = (Object[]) map.get(key); + obj = request == null ? arr : (request.getParameter((String) key) == null ? arr : arr[0]); + } else { + obj = map.get(key); + } + return obj; + } + + public String getString(Object key) { + return (String) get(key); + } + + @Override + public Object put(Object key, Object value) { + if (value instanceof ClobProxyImpl) { // 读取oracle Clob类型数据 + try { + ClobProxyImpl cpi = (ClobProxyImpl) value; + Reader is = cpi.getCharacterStream(); // 获取流 + BufferedReader br = new BufferedReader(is); + String str = br.readLine(); + StringBuffer sb = new StringBuffer(); + while (str != null) { // 循环读取数据拼接到字符串 + sb.append(str); + sb.append("\n"); + str = br.readLine(); + } + value = sb.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return map.put(key, value); + } + + @Override + public Object remove(Object key) { + return map.remove(key); + } + + public void clear() { + map.clear(); + } + + public boolean containsKey(Object key) { + // TODO Auto-generated method stub + return map.containsKey(key); + } + + public boolean containsValue(Object value) { + // TODO Auto-generated method stub + return map.containsValue(value); + } + + public Set entrySet() { + // TODO Auto-generated method stub + return map.entrySet(); + } + + public boolean isEmpty() { + // TODO Auto-generated method stub + return map.isEmpty(); + } + + public Set keySet() { + // TODO Auto-generated method stub + return map.keySet(); + } + + @SuppressWarnings("unchecked") + public void putAll(Map t) { + // TODO Auto-generated method stub + map.putAll(t); + } + + public int size() { + // TODO Auto-generated method stub + return map.size(); + } + + public Collection values() { + // TODO Auto-generated method stub + return map.values(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysCaptchaEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysCaptchaEntity.java new file mode 100644 index 0000000..6f0660c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysCaptchaEntity.java @@ -0,0 +1,31 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * 系统验证码 + * + * + */ +@Data +@TableName("sys_captcha") +public class SysCaptchaEntity { + @TableId(type = IdType.INPUT) + private String uuid; + /** + * 验证码 + */ + private String code; + /** + * 过期时间 + */ + private Date expireTime; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysConfigEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysConfigEntity.java new file mode 100644 index 0000000..9de404d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysConfigEntity.java @@ -0,0 +1,27 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 系统配置信息 + * + * + */ +@Data +@TableName("sys_config") +public class SysConfigEntity { + @TableId + private String id; + @NotBlank(message="参数名不能为空") + private String paramKey; + @NotBlank(message="参数值不能为空") + private String paramValue; + private String remark; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysDictionariesEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysDictionariesEntity.java new file mode 100644 index 0000000..922cf54 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysDictionariesEntity.java @@ -0,0 +1,87 @@ +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @TableName sys_dictionaries + */ +@Data +@TableName("sys_dictionaries") +public class SysDictionariesEntity implements Serializable,Comparable { + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + @TableId(value = "dictionaries_id") + @TableField(value = "dictionaries_id") + @JsonProperty(value = "dictionaries_id") + @ApiModelProperty(value = "主键") + private String dictionariesId; + + /** + * 父id + */ + @ApiModelProperty(value = "父ID") + @TableField(value = "parent_id") + @JsonProperty(value = "parent_id") + private String parentId; + + /** + * 名称 + */ + @ApiModelProperty(value = "字典名称") + @TableField(value = "name") + @JsonProperty(value = "name") + private String name; + + /** + * 编码 + */ + @ApiModelProperty(value = "字典编码") + @TableField(value = "bianma") + @JsonProperty(value = "bianma") + private String bianma; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + @TableField(value = "order_by") + @JsonProperty(value = "order_by") + private Integer orderBy; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @TableField(value = "descr") + @JsonProperty(value = "descr") + private String descr; + + //子集数量 + @TableField(exist=false) + @ApiModelProperty(value = "子集数量") + private Integer hasChildren; + + /** + * ztree属性 + */ + @TableField(exist=false) + @ApiModelProperty(value = "子集列表") + private List list=new ArrayList<>(); + @Override + public int compareTo(SysDictionariesEntity o) { + return this.getOrderBy()-o.getOrderBy(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysLogEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysLogEntity.java new file mode 100644 index 0000000..b8e67d9 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysLogEntity.java @@ -0,0 +1,42 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 系统日志 + * + * + */ +@Data +@TableName("sys_log") +public class SysLogEntity implements Serializable { + private static final long serialVersionUID = 1L; + @TableId(type = IdType.AUTO) + private String id; + //用户名 + private String username; + //用户操作 + private String operation; + //请求方法 + private String method; + //请求参数 + private String params; + //执行时长(毫秒) + private Long time; + //IP地址 + private String ip; + //创建时间 + private Date createDate; + //所属企业 + private String corpinfoId; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysMenuEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysMenuEntity.java new file mode 100644 index 0000000..2767286 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysMenuEntity.java @@ -0,0 +1,110 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 菜单管理 + * + * + */ +@Data +@TableName("sys_menu") +public class SysMenuEntity implements Serializable,Comparable { + private static final long serialVersionUID = 1L; + + /** + * 菜单ID + */ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer menuId; + + /** + * 父菜单ID,一级菜单为0 + */ + @ApiModelProperty(value = "父菜单ID") + private Integer parentId; + + /** + * 父菜单名称 + */ + @TableField(exist=false) + @ApiModelProperty(value = "父菜单名称") + private String parentName; + + /** + * 菜单名称 + */ + @ApiModelProperty(value = "菜单名称") + private String name; + + /** + * 菜单URL + */ + @ApiModelProperty(value = "菜单URL") + private String path; + + /** + * 菜单重定向 + */ + @ApiModelProperty(value = "菜单重定向") + private String redirect; + + /** + * 菜单组件 + */ + @ApiModelProperty(value = "菜单组件") + private String component; + + /** + * 授权(多个用逗号分隔,如:user:list,user:create) + */ + @ApiModelProperty(value = "授权") + private String perms; + + /** + * 类型 1:菜单 2:按钮 + */ + @ApiModelProperty(value = "类型 1:菜单 2:按钮") + private Integer type; + + /** + * 菜单meta + */ + @ApiModelProperty(value = "菜单meta") + private String meta; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer orderNum; + + /** + * 是否删除 + */ + @TableLogic + @ApiModelProperty(value = "是否删除") + @TableField(fill = FieldFill.INSERT) + private Integer isDelete; + + /** + * ztree属性 + */ + @TableField(exist=false) + @ApiModelProperty(value = "子集列表") + private List list=new ArrayList<>(); + + @Override + public int compareTo(SysMenuEntity o) { + return this.getOrderNum()-o.getOrderNum(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysRoleEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysRoleEntity.java new file mode 100644 index 0000000..4167959 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysRoleEntity.java @@ -0,0 +1,58 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 角色 + * + * + */ +@Data +@TableName("sys_role") +public class SysRoleEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + @TableId + private String roleId; + + /** + * 角色名称 + */ + @NotBlank(message="角色名称不能为空") + private String roleName; + + /** + * 备注 + */ + private String remark; + + /** + * 创建者ID + */ + private String creator; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private String createTime; + + @TableField(exist=false) + private List menuIdList; + + @TableField(exist=false) + private String[] roleIds; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysRoleMenuEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysRoleMenuEntity.java new file mode 100644 index 0000000..c2bf908 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysRoleMenuEntity.java @@ -0,0 +1,34 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * 角色与菜单对应关系 + * + * + */ +@Data +@TableName("sys_role_menu") +public class SysRoleMenuEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 菜单ID + */ + private int menuId; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserEntity.java new file mode 100644 index 0000000..9d0c5c8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserEntity.java @@ -0,0 +1,306 @@ + + +package com.zcloud.modules.sys.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.shiro.crypto.hash.SimpleHash; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.Period; +import java.util.regex.Pattern; + +/** + * 系统用户 + * + * + */ +@Data +@TableName("sys_user") +public class SysUserEntity implements Serializable { + private static final long serialVersionUID = -69078984620623053L; + //用户ID + @ApiModelProperty(value = "用户ID") + @TableId + private String userId; + @ApiModelProperty(value = "用户ID") + @TableField(exist = false) + private String selectUserId; + //用户名 + @ApiModelProperty(value = "用户名") + private String username; + //密码 + @ApiModelProperty(value = "密码") + private String password; + //姓名 + @ApiModelProperty(value = "姓名") + private String name; + //角色ID + @ApiModelProperty(value = "角色ID") + private String roleId; + @ApiModelProperty(value = "角色名称") + @TableField(exist = false) + private String rolesName; + //最近登录时间 + @ApiModelProperty(value = "最近登录时间") + private String lastLogin; + //IP + @ApiModelProperty(value = "IP") + private String ip; + //状态0.正常 99.锁定 2密码错误次数超过当天限制 + @ApiModelProperty(value = "状态0.正常 99.锁定 2密码错误次数超过当天限制") + private Integer status; + //备注 + @ApiModelProperty(value = "备注") + private String bz; + //皮肤 + @ApiModelProperty(value = "皮肤") + private String skin; + //邮箱 + @ApiModelProperty(value = "邮箱") + private String email; + //编码 + @ApiModelProperty(value = "编码") + private String number; + //电话 + @ApiModelProperty(value = "电话") + private String phone; + //副职角色ID组 + @ApiModelProperty(value = "副职角色ID组") + private String roleIds; + //部门ID + @ApiModelProperty(value = "部门ID") + private String departmentId; + @TableField(exist = false) + @ApiModelProperty(value = "部门名称") + private String departmentName; + @TableField(exist = false) + @ApiModelProperty(value = "部门名称-全") + private String departmentNameAll; + + //企业 + @ApiModelProperty(value = "企业") + private String corpinfoId; + //小程序菜单ID组 + @ApiModelProperty(value = "小程序菜单ID组") + private String funIds; + //微信码 + @ApiModelProperty(value = "微信码") + private String appid; + //岗位 + @ApiModelProperty(value = "岗位") + private String postId; + //岗位 + @ApiModelProperty(value = "岗位名称") + @TableField(exist = false) + private String postName; + //是否主账号 + @ApiModelProperty(value = "是否主账号") + private String ismain; + //登录错误次数 + @ApiModelProperty(value = "登录错误次数") + private Integer errorCount; + //人员在部门中的排序 + @ApiModelProperty(value = "人员在部门中的排序") + private Integer sort; + //在线学习人员类别 + @ApiModelProperty(value = "在线学习人员类别") + private String learnercategory; + //人员头像数据前缀 + @ApiModelProperty(value = "人员头像数据前缀") + private String useravatarprefix; + //人员头像数据 + @ApiModelProperty(value = "人员头像数据") + private String useravatarurl; + //倒班类型-1级 + @ApiModelProperty(value = "倒班类型-1级") + private String shiftdutyone; + //倒班类型-2级 + @ApiModelProperty(value = "倒班类型-2级") + private String shiftdutytwo; + //工作状态持续时间(天)(上班或休班) + @ApiModelProperty(value = "工作状态持续时间(天)(上班或休班)") + private String duration; + //工作状态 1-上班 2-休班 + @ApiModelProperty(value = "工作状态 1-上班 2-休班") + private String workstatus; + //当前工作周期数 + @ApiModelProperty(value = "当前工作周期数") + private String workperiod; + private String isRecorder; + //人员类型 + @ApiModelProperty(value = "人员类型") + private String personnelType; + @ApiModelProperty(value = "人员类型名称") + @TableField(exist = false) + private String personnelTypeName; + //是否为隐患确认人0否1是 + @ApiModelProperty(value = "是否为隐患确认人0否1是") + private Integer isHazardconfirmer; + //是否为临时访问审核人(0:否,1:是) + @ApiModelProperty(value = "是否为临时访问审核人(0:否,1:是)") + private String isAccessauditor; + //是否在线学习人员 + @ApiModelProperty(value = "是否在线学习人员") + private Integer isOnlinelearning; + //人员类型 + @Deprecated + @ApiModelProperty(value = "人员类型(废弃)") + private String personType; + //emis对接人员 + @ApiModelProperty(value = "emis对接人员") + private String jcr; + //推送id + @ApiModelProperty(value = "推送id") + private String pushCid; + //工号(人员定位使用) + @ApiModelProperty(value = "工号(人员定位使用)") + private String empno; + //曹妃甸数据人员状态 0企业端 1监管端 此字段用于港务局给曹妃甸发起安全环保检查选择人员 只选曹妃甸该字段值为1的人员 + @ApiModelProperty(value = "曹妃甸数据人员状态 0企业端 1监管端 此字段用于港务局给曹妃甸发起安全环保检查选择人员 只选曹妃甸该字段值为1的人员") + private String cfdStatus; + //卡号(人员定位使用) + @ApiModelProperty(value = "卡号(人员定位使用)") + private String cardno; + //修改人 + @ApiModelProperty(value = "身份证号") + private String userIdCard; + //人员标识用作手机app登录(12.15新加如需删除请联系王轩) + @ApiModelProperty(value = "人员标识用作手机app登录(12.15新加如需删除请联系王轩)") + private String userIdentity; + private String baseimgpath; + private String backendaddr; + //门口门禁人员编号(门口门禁使用) + @ApiModelProperty(value = "门口门禁人员编号(门口门禁使用)") + private String mkmjcard; + //是否推送到中台 + @ApiModelProperty(value = "是否推送到中台") + private String ispush; + //1监管2企业3相关方 + @ApiModelProperty(value = "1监管2企业3相关方") + private String userType; + //是否在人资系统存在(0:未确认,1:通过姓名和手机号确认,2:用户已手动确认,3:人资修改人员) + @ApiModelProperty(value = "是否在人资系统存在(0:未确认,1:通过姓名和手机号确认,2:用户已手动确认,3:人资修改人员)") + private String inHrUser; + //是否删除,0否1是 + @ApiModelProperty(value = "是否删除,0否1是") + @TableLogic + private Integer isDelete; + //创建人 + @ApiModelProperty(value = "创建人") + private String creator; + //创建时间 + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private String createTime; + //修改人 + @ApiModelProperty(value = "修改人") + private String operat; + //修改时间 + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String operatTime; + @TableField(exist=false) + @ApiModelProperty(value = "用户ID列表") + private String[] userIds; + @TableField(exist=false) + @ApiModelProperty(value = "部门排序") + private Integer departSort; + + @TableField(exist=false) + @ApiModelProperty(value = "企业名称") + private String corpinfoName; + @TableField(exist=false) + @ApiModelProperty(value = "班级数") + private String classCount; + @TableField(exist=false) + @ApiModelProperty(value = "已完成班级数") + private String completeCount; + @TableField(exist=false) + @ApiModelProperty(value = "学习状态") + private String studystate; + + @TableField(exist=false) + @ApiModelProperty(value = "企业状态") + private Integer corpInfoStatus; + + /** + * 根据中国大陆18位身份证号计算年龄 + * + * @param idCard 身份证号 + * @return 当前年龄,若身份证号格式错误则返回null + */ + @JsonIgnore + @JSONField(serialize = false) + public static Integer calculateAgeByIdCard(String idCard) { + if (idCard == null || idCard.length()!= 18) { + return null; + } + // 校验身份证号合法性,简单校验,更严谨需引入身份证号校验库 + boolean isValid = Pattern.matches("^[1-9]\\d{5}(18|19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])\\d{3}[0-9Xx]$", idCard); + if (!isValid) { + return null; + } + // 提取出生年月日 + String birthYear = idCard.substring(6, 10); + String birthMonth = idCard.substring(10, 12); + String birthDay = idCard.substring(12, 14); + LocalDate birthday; + try { + birthday = LocalDate.of(Integer.parseInt(birthYear), Integer.parseInt(birthMonth), Integer.parseInt(birthDay)); + } catch (Exception e) { + return null; + } + return calculateAge(birthday); + } + + public Integer getAge() { + return calculateAgeByIdCard(this.cardno); + } + + @ApiModelProperty(value = "职务 监管字段") + private String job; + + @ApiModelProperty(value = "职务级别 监管字段") + private String jobLevel; + + @ApiModelProperty(value = "物业公司ID") + private String basicinfoId; + + @ApiModelProperty(value = "管理区") + private String precinctId; + + @TableField(exist=false) + @ApiModelProperty(value = "角色名称") + private String roleName; + + /** + * 根据生日计算当前年龄 + * + * @param birthday 用户生日 + * @return 当前年龄,若生日为空则返回null + */ + @JsonIgnore + @JSONField(serialize = false) + public static Integer calculateAge(LocalDate birthday) { + if (birthday == null) { + return null; + } + LocalDate currentDate = LocalDate.now(); + Period period = Period.between(birthday, currentDate); + return period.getYears(); + } + /** + * 获取默认登录密码 + */ + @JsonIgnore + @JSONField(serialize = false) + public String getDefaultPassword() { + return new SimpleHash("SHA-1", this.getUsername(), "Aa@123456789").toString(); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserRoleEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserRoleEntity.java new file mode 100644 index 0000000..a4d7d8a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserRoleEntity.java @@ -0,0 +1,34 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户与角色对应关系 + * + * + */ +@Data +@TableName("sys_user_role") +public class SysUserRoleEntity implements Serializable { + private static final long serialVersionUID = 1L; + @TableId + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 角色ID + */ + private String roleId; + + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserTokenEntity.java b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserTokenEntity.java new file mode 100644 index 0000000..4b67170 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/entity/SysUserTokenEntity.java @@ -0,0 +1,38 @@ + + +package com.zcloud.modules.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 系统用户Token + * + * + */ +@Data +@TableName("sys_user_token") +public class SysUserTokenEntity implements Serializable { + private static final long serialVersionUID = 1L; + + //用户ID + @TableField(value = "user_id") + @TableId(type = IdType.INPUT) + private String userId; + //token + private String token; + //过期时间 + @TableField(value = "expire_time" ) + private Date expireTime; + //更新时间 + @TableField(value = "update_time" ) + private Date updateTime; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/form/PasswordForm.java b/review_repo/src/main/java/com/zcloud/modules/sys/form/PasswordForm.java new file mode 100644 index 0000000..6a82b24 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/form/PasswordForm.java @@ -0,0 +1,27 @@ + + +package com.zcloud.modules.sys.form; + +import lombok.Data; + +/** + * 密码表单 + * + * + */ +@Data +public class PasswordForm { + /** + * 原密码 + */ + private String password; + /** + * 新密码 + */ + private String newPassword; + /** + * 用户Id + */ + private String userId; + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/form/SysLoginForm.java b/review_repo/src/main/java/com/zcloud/modules/sys/form/SysLoginForm.java new file mode 100644 index 0000000..7e20dc5 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/form/SysLoginForm.java @@ -0,0 +1,27 @@ + + +package com.zcloud.modules.sys.form; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 登录表单 + * + */ +@Data +@ApiModel(value = "登录表单") +public class SysLoginForm { + @ApiModelProperty(value = "用户名") + @NotBlank(message="用户名不能为空") + private String username; + + @ApiModelProperty(value = "密码") + @NotBlank(message="密码不能为空") + private String password; +// private String captcha; +// private String uuid; +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/form/SysUserForm.java b/review_repo/src/main/java/com/zcloud/modules/sys/form/SysUserForm.java new file mode 100644 index 0000000..95c2639 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/form/SysUserForm.java @@ -0,0 +1,81 @@ +package com.zcloud.modules.sys.form; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author WL + * @Desc 系统用户(SysUser)实体 + * @Date 2024-09-29 11:20:21 + */ +@Data +public class SysUserForm implements Serializable { + private String userId; + //用户名 + @ApiModelProperty(value = "用户名") + private String username; + //密码 + @ApiModelProperty(value = "密码") + private String password; + //姓名 + @ApiModelProperty(value = "姓名") + private String name; + //年龄 + @ApiModelProperty(value = "年龄") + private String age; + //性别 + @ApiModelProperty(value = "性别") + private String sex; + //部门ID + @ApiModelProperty(value = "部门ID") + private String departmentId; + //部门ID + @ApiModelProperty(value = "部门ID") + private String departmentName; + //岗位 + @ApiModelProperty(value = "岗位") + private String postId; + //岗位 + @ApiModelProperty(value = "岗位") + private String postName; + //邮箱 + @ApiModelProperty(value = "邮箱") + private String email; + //手机号 + @ApiModelProperty(value = "手机号") + private String mobile; + //学历 + @ApiModelProperty(value = "学历") + private String degree; + //学历 + @ApiModelProperty(value = "学历") + private String degreeName; + //身份证号 + @ApiModelProperty(value = "身份证号") + private String userIdCard; + //类型:1-管理 0-普通员工 + @ApiModelProperty(value = "类型:1-管理 0-普通员工") + private String type; + //状态 0:禁用 1:正常 + @ApiModelProperty(value = "状态 0:禁用 1:正常") + private Integer status; + //是否删除(0:有效 1:删除) + @ApiModelProperty(value = "是否删除(0:有效 1:删除)") + private Integer isDelete; + //创建者ID + @ApiModelProperty(value = "创建者ID") + private String creator; + //创建时间 + @ApiModelProperty(value = "创建时间") + private String createTime; + //修改人 + @ApiModelProperty(value = "修改人") + private String operator; + //修改时间 + @ApiModelProperty(value = "修改时间") + private String operatTime; + +} + diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Filter.java b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Filter.java new file mode 100644 index 0000000..096c9ff --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Filter.java @@ -0,0 +1,99 @@ +package com.zcloud.modules.sys.oauth2; + +import com.google.gson.Gson; +import com.zcloud.common.utils.HttpContextUtils; +import com.zcloud.common.utils.R; +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpStatus; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.web.filter.authc.AuthenticatingFilter; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * oauth2过滤器 + * + */ +public class OAuth2Filter extends AuthenticatingFilter { + + @Override + protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception { + //获取请求token + String token = getRequestToken((HttpServletRequest) request); + + if(StringUtils.isBlank(token)){ + return null; + } + + return new OAuth2Token(token); + } + + @Override + protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { + if(((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())){ + return true; + } + + return false; + } + + @Override + protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { + //获取请求token,如果token不存在,直接返回401 + String token = getRequestToken((HttpServletRequest) request); + if(StringUtils.isBlank(token)){ + HttpServletResponse httpResponse = (HttpServletResponse) response; + httpResponse.setHeader("Access-Control-Allow-Credentials", "true"); + httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin()); + + String json = new Gson().toJson(R.error(HttpStatus.SC_UNAUTHORIZED, "invalid token")); + + httpResponse.getWriter().print(json); + + return false; + } + + return executeLogin(request, response); + } + + @Override + protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { + HttpServletResponse httpResponse = (HttpServletResponse) response; + httpResponse.setContentType("application/json;charset=utf-8"); + httpResponse.setHeader("Access-Control-Allow-Credentials", "true"); + httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin()); + try { + //处理登录失败的异常 + Throwable throwable = e.getCause() == null ? e : e.getCause(); + R r = R.error(HttpStatus.SC_UNAUTHORIZED, throwable.getMessage()); + + String json = new Gson().toJson(r); + httpResponse.getWriter().print(json); + } catch (IOException e1) { + + } + + return false; + } + + /** + * 获取请求的token + */ + private String getRequestToken(HttpServletRequest httpRequest){ + //从header中获取token + String token = httpRequest.getHeader("token"); + + //如果header中不存在token,则从参数中获取token + if(StringUtils.isBlank(token)){ + token = httpRequest.getParameter("token"); + } + + return token; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Realm.java b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Realm.java new file mode 100644 index 0000000..d1fe5dc --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Realm.java @@ -0,0 +1,69 @@ +package com.zcloud.modules.sys.oauth2; + +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.entity.SysUserTokenEntity; +import com.zcloud.modules.sys.service.ShiroService; +import org.apache.shiro.authc.*; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.authz.SimpleAuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Set; + +/** + * 认证 + */ +@Component +public class OAuth2Realm extends AuthorizingRealm { + @Autowired + private ShiroService shiroService; + + @Override + public boolean supports(AuthenticationToken token) { + return token instanceof OAuth2Token; + } + + /** + * 授权(验证权限时调用) + */ + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { + SysUserEntity user = (SysUserEntity)principals.getPrimaryPrincipal(); + String userId = user.getUserId(); + + //用户权限列表 + Set permsSet = shiroService.getUserPermissions(userId); + + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + info.setStringPermissions(permsSet); + return info; + } + + /** + * 认证(登录时调用) + */ + @Override + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { + String accessToken = (String) token.getPrincipal(); + + //根据accessToken,查询用户信息 + SysUserTokenEntity tokenEntity = shiroService.queryByToken(accessToken); + //token失效 + if(tokenEntity == null || tokenEntity.getExpireTime().getTime() < System.currentTimeMillis()){ + throw new IncorrectCredentialsException("token失效,请重新登录"); + } + + //查询用户信息 + SysUserEntity user = shiroService.queryUser(tokenEntity.getUserId()); + //账号锁定 + if(user.getStatus() == 99){ + throw new LockedAccountException("账号已被锁定,请联系管理员"); + } + + SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, accessToken, getName()); + return info; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Token.java b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Token.java new file mode 100644 index 0000000..381cd71 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/OAuth2Token.java @@ -0,0 +1,25 @@ +package com.zcloud.modules.sys.oauth2; + +import org.apache.shiro.authc.AuthenticationToken; + +/** + * token + * + */ +public class OAuth2Token implements AuthenticationToken { + private String token; + + public OAuth2Token(String token){ + this.token = token; + } + + @Override + public String getPrincipal() { + return token; + } + + @Override + public Object getCredentials() { + return token; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/TokenGenerator.java b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/TokenGenerator.java new file mode 100644 index 0000000..3bcc24b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/oauth2/TokenGenerator.java @@ -0,0 +1,44 @@ +package com.zcloud.modules.sys.oauth2; + +import com.zcloud.common.exception.ZException; + +import java.security.MessageDigest; +import java.util.UUID; + +/** + * 生成token + * + * + */ +public class TokenGenerator { + + public static String generateValue() { + return generateValue(UUID.randomUUID().toString()); + } + + private static final char[] hexCode = "0123456789abcdef".toCharArray(); + + public static String toHexString(byte[] data) { + if(data == null) { + return null; + } + StringBuilder r = new StringBuilder(data.length*2); + for ( byte b : data) { + r.append(hexCode[(b >> 4) & 0xF]); + r.append(hexCode[(b & 0xF)]); + } + return r.toString(); + } + + public static String generateValue(String param) { + try { + MessageDigest algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(param.getBytes()); + byte[] messageDigest = algorithm.digest(); + return toHexString(messageDigest); + } catch (Exception e) { + throw new ZException("生成Token失败", e); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/redis/SysConfigRedis.java b/review_repo/src/main/java/com/zcloud/modules/sys/redis/SysConfigRedis.java new file mode 100644 index 0000000..23ccf5a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/redis/SysConfigRedis.java @@ -0,0 +1,39 @@ + + +package com.zcloud.modules.sys.redis; + + +import com.zcloud.common.utils.RedisKeys; +import com.zcloud.common.utils.RedisUtils; +import com.zcloud.modules.sys.entity.SysConfigEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 系统配置Redis + * + * + */ +@Component +public class SysConfigRedis { + @Autowired + private RedisUtils redisUtils; + + public void saveOrUpdate(SysConfigEntity config) { + if(config == null){ + return ; + } + String key = RedisKeys.getSysConfigKey(config.getParamKey()); + redisUtils.set(key, config); + } + + public void delete(String configKey) { + String key = RedisKeys.getSysConfigKey(configKey); + redisUtils.delete(key); + } + + public SysConfigEntity get(String configKey){ + String key = RedisKeys.getSysConfigKey(configKey); + return redisUtils.get(key, SysConfigEntity.class); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/BusImgfilesService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/BusImgfilesService.java new file mode 100644 index 0000000..a698b95 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/BusImgfilesService.java @@ -0,0 +1,28 @@ +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.entity.BusImgfilesEntity; + +import java.util.List; +import java.util.Map; + +/** + * @Author fangjiakai + * @Desc 图片附件(BusImgfiles)表服务接口 + * @Date 2023-10-19 15:09:20 + */ +public interface BusImgfilesService extends IService { + + /** + * 分页查询 + */ + PageUtils listPage(Map params); + + /** + * 通过主键删除数据 + */ + void delete(String imgfilesId); + + List queryListByFlexibleParams(String paramName, Object paramValue); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/ShiroService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/ShiroService.java new file mode 100644 index 0000000..011486e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/ShiroService.java @@ -0,0 +1,25 @@ +package com.zcloud.modules.sys.service; + +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.entity.SysUserTokenEntity; + +import java.util.Set; + +/** + * shiro相关接口 + * + */ +public interface ShiroService { + /** + * 获取用户权限列表 + */ + Set getUserPermissions(String userId); + + SysUserTokenEntity queryByToken(String token); + + /** + * 根据用户ID,查询用户 + * @param userId + */ + SysUserEntity queryUser(String userId); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysCaptchaService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysCaptchaService.java new file mode 100644 index 0000000..cada04a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysCaptchaService.java @@ -0,0 +1,29 @@ + + +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.sys.entity.SysCaptchaEntity; + +import java.awt.image.BufferedImage; + +/** + * 验证码 + * + * + */ +public interface SysCaptchaService extends IService { + + /** + * 获取图片验证码 + */ + BufferedImage getCaptcha(String uuid); + + /** + * 验证码效验 + * @param uuid uuid + * @param code 验证码 + * @return true:成功 false:失败 + */ + boolean validate(String uuid, String code); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysConfigService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysConfigService.java new file mode 100644 index 0000000..15b0366 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysConfigService.java @@ -0,0 +1,54 @@ + + +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.entity.SysConfigEntity; + +import java.util.Map; + +/** + * 系统配置信息 + * + * + */ +public interface SysConfigService extends IService { + + PageUtils queryPage(Map params); + + /** + * 保存配置信息 + */ + public void saveConfig(SysConfigEntity config); + + /** + * 更新配置信息 + */ + public void update(SysConfigEntity config); + + /** + * 根据key,更新value + */ + public void updateValueByKey(String key, String value); + + /** + * 删除配置信息 + */ + public void deleteBatch(String[] ids); + + /** + * 根据key,获取配置的value值 + * + * @param key key + */ + public String getValue(String key); + + /** + * 根据key,获取value的Object对象 + * @param key key + * @param clazz Object对象 + */ + public T getConfigObject(String key, Class clazz); + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysDictionariesService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysDictionariesService.java new file mode 100644 index 0000000..1aef6bd --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysDictionariesService.java @@ -0,0 +1,78 @@ +package com.zcloud.modules.sys.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.entity.SysDictionariesEntity; + +import java.util.List; +import java.util.Map; + + +/** + * 字典管理 + */ +public interface SysDictionariesService extends IService { + + PageUtils queryPage(Map params); + + /** + * 根据父字典,查询子字典 + * @param parentId 父字典ID + */ + List queryListParentId(String parentId); + + /** + * 根据父字典,递归查询子字典 + * @param parentId 父字典ID + */ + public List getAllList(String parentId); + /** + * 删除 + */ + void delete(String dictionaries); + + /** + * 根据编码查询 + * @param id + */ + SysDictionariesEntity queryByBianma(String id); + + /** + * 根据ID递归查询所有ID + * @param bianma 编码 + */ + String getRecurrenceIds(String bianma); + + + SysDictionariesEntity getByName(String name, String parentId); + + + // private List getAlldictionariesList(List dictionariesIdList){ +// //查询根菜单列表 +// List dictionariesList = queryListParentId(0, dictionariesIdList); +// //递归获取子菜单 +// getdictionariesTreeList(dictionariesList, dictionariesIdList); +// +// return dictionariesList; +// } + +// /** +// * 递归 +// */ +// private List getdictionariesTreeList(List dictionariesList, List dictionariesIdList){ +// List subdictionariesList = new ArrayList(); +// +// for(SysDictionariesEntity entity : dictionariesList){ +// //目录 +// if(entity.getType() == Constant.dictionariesType.CATALOG.getValue()){ +// entity.setList(getdictionariesTreeList(queryListParentId(entity.getdictionariesId(), dictionariesIdList), dictionariesIdList)); +// } +// subdictionariesList.add(entity); +// } +// +// return subdictionariesList; +// } + + void importAreaFromJson(); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysLogService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysLogService.java new file mode 100644 index 0000000..f791b16 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysLogService.java @@ -0,0 +1,23 @@ + + +package com.zcloud.modules.sys.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.entity.SysLogEntity; + +import java.util.Map; + + +/** + * 系统日志 + * + * + */ +public interface SysLogService extends IService { + + PageUtils queryPage(Map params); + + void saveLog(SysLogEntity logEntity); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysMenuService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysMenuService.java new file mode 100644 index 0000000..07db688 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysMenuService.java @@ -0,0 +1,56 @@ + + +package com.zcloud.modules.sys.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.sys.entity.SysMenuEntity; + +import java.util.List; + + +/** + * 菜单管理 + * + * + */ +public interface SysMenuService extends IService { + + /** + * 根据父菜单,查询子菜单 + * @param parentId 父菜单ID + * @param menuIdList 用户菜单ID + */ + List queryListParentId(Integer parentId, List menuIdList); + + /** + * 根据父菜单,查询子菜单 + * @param parentId 父菜单ID + */ + List queryListParentId(Integer parentId); + + /** + * 获取不包含按钮的菜单列表 + */ + List queryNotButtonList(Integer parentId); + + /** + * 获取用户菜单列表 + */ + List getUserMenuList(String userId); + + /** + * 删除 + */ + void delete(Integer menuId); + + /** + * 获取全部菜单列表 + */ + List getAllList(Integer parentId); + + /** + * 获取全部菜单列表 + */ + List getAllListNotButton(Integer parentId); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysRoleMenuService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysRoleMenuService.java new file mode 100644 index 0000000..5ca1801 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysRoleMenuService.java @@ -0,0 +1,31 @@ + + +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.sys.entity.SysRoleMenuEntity; + +import java.util.List; + + + +/** + * 角色与菜单对应关系 + * + * + */ +public interface SysRoleMenuService extends IService { + + void saveOrUpdate(String roleId, List menuIdList); + + /** + * 根据角色ID,获取菜单ID列表 + */ + List queryMenuIdList(String roleId); + + /** + * 根据角色ID数组,批量删除 + */ + int deleteBatch(String[] roleIds); + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysRoleService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysRoleService.java new file mode 100644 index 0000000..4f1d602 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysRoleService.java @@ -0,0 +1,33 @@ + + +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.entity.SysRoleEntity; + +import java.util.List; +import java.util.Map; + + +/** + * 角色 + * + * + */ +public interface SysRoleService extends IService { + + PageUtils queryPage(Map params); + + void saveRole(SysRoleEntity role); + + void update(SysRoleEntity role); + + void deleteBatch(String[] roleIds); + + + /** + * 查询用户创建的角色ID列表 + */ + List queryRoleIdList(String createUserId); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserRoleService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserRoleService.java new file mode 100644 index 0000000..33eaa31 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserRoleService.java @@ -0,0 +1,30 @@ + + +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.modules.sys.entity.SysUserRoleEntity; + +import java.util.List; + + + +/** + * 用户与角色对应关系 + * + * + */ +public interface SysUserRoleService extends IService { + + void saveOrUpdate(String userId, List roleIdList); + + /** + * 根据用户ID,获取角色ID列表 + */ + List queryRoleIdList(String userId); + + /** + * 根据角色ID数组,批量删除 + */ + int deleteBatch(String[] roleIds); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserService.java new file mode 100644 index 0000000..0ea936a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserService.java @@ -0,0 +1,70 @@ + + +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.SysUserEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Map; + + +/** + * 系统用户 + * + * + */ +public interface SysUserService extends IService { + + PageUtils queryPage(Map params); + + SysUserEntity queryById(String userId); + + /** + * 查询用户的所有权限 + * @param userId 用户ID + */ + List queryAllPerms(String userId); + + /** + * 查询用户的所有菜单ID + */ + List queryAllMenuId(String userId); + + /** + * 根据用户名,查询系统用户 + */ + SysUserEntity queryByUserName(String username); + + /** + * 保存用户 + */ + void saveUser(SysUserEntity user); + + /** + * 修改用户 + */ + void update(SysUserEntity user); + + + /** + * 修改密码 + * @param userId 用户ID + * @param password 原密码 + * @param newPassword 新密码 + */ + boolean updatePassword(String userId, String password, String newPassword); + + /** + * 获取全部用户 (不分页) + */ + List listAll(Map params); + + /** + * 下拉用户列表(不分页) + */ + List listForSelect(Map params); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserTokenService.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserTokenService.java new file mode 100644 index 0000000..1a4bf35 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/SysUserTokenService.java @@ -0,0 +1,31 @@ +package com.zcloud.modules.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.entity.SysUserTokenEntity; + +/** + * 用户Token + * + * @author Mark sunlightcs@gmail.com + */ +public interface SysUserTokenService extends IService { + + /** + * 生成token + * @param userId 用户ID + */ + R createToken(String userId); + + /** + * 退出,修改token值 + * @param userId 用户ID + */ + void logout(String userId); + + /** + * 刷新token值 + * @param userId 用户ID + */ + void refreshToken(String userId); +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/BusImgfilesServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/BusImgfilesServiceImpl.java new file mode 100644 index 0000000..4c45b1c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/BusImgfilesServiceImpl.java @@ -0,0 +1,50 @@ +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.FileUploadUtil; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.dao.BusImgfilesDao; +import com.zcloud.modules.sys.entity.BusImgfilesEntity; +import com.zcloud.modules.sys.service.BusImgfilesService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * @Author fangjiakai + * @Desc 图片附件(BusImgfiles)表服务实现类 + * @Date 2023-10-19 15:09:20 + */ +@Service("busImgfilesService") +public class BusImgfilesServiceImpl extends ServiceImpl implements BusImgfilesService { + + @Override + public PageUtils listPage(Map params) { + Page> page = new Page<>(Integer.parseInt(params.get("curPage").toString()),Integer.parseInt(params.get("limit").toString())); + params.put("isDelete",0); + IPage> ipage = baseMapper.listPage(page,params); + return new PageUtils(ipage); + } + + + @Override + public void delete(String imgfilesId) { + BusImgfilesEntity busImgfiles = getById(imgfilesId); + FileUploadUtil.deleteFile(busImgfiles.getFilepath()); + + this.removeById(imgfilesId); + } + + @Override + public List queryListByFlexibleParams(String paramName, Object paramValue) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(paramName, paramValue); // 根据传入的参数名和参数值动态构建查询条件 + + return baseMapper.selectList(queryWrapper); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/ShiroServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/ShiroServiceImpl.java new file mode 100644 index 0000000..683c2d8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/ShiroServiceImpl.java @@ -0,0 +1,62 @@ + + +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.zcloud.modules.sys.dao.SysMenuDao; +import com.zcloud.modules.sys.dao.SysUserDao; +import com.zcloud.modules.sys.dao.SysUserTokenDao; +import com.zcloud.modules.sys.entity.SysMenuEntity; +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.entity.SysUserTokenEntity; +import com.zcloud.modules.sys.service.ShiroService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; + +@Service +public class ShiroServiceImpl implements ShiroService { + @Autowired + private SysMenuDao sysMenuDao; + @Autowired + private SysUserDao sysUserDao; + @Autowired + private SysUserTokenDao sysUserTokenDao; + + @Override + public Set getUserPermissions(String userId) { + List permsList; + + //系统管理员,拥有最高权限 + if(userId.equals("1")){ + List menuList = sysMenuDao.selectList(new QueryWrapper().eq("is_delete", 0)); + permsList = new ArrayList<>(menuList.size()); + for(SysMenuEntity menu : menuList){ + permsList.add(menu.getPerms()); + } + }else{ + permsList = sysUserDao.queryAllPerms(userId); + } + //用户权限列表 + Set permsSet = new HashSet<>(); + for(String perms : permsList){ + if(StringUtils.isBlank(perms)){ + continue; + } + permsSet.addAll(Arrays.asList(perms.trim().split(","))); + } + return permsSet; + } + + @Override + public SysUserTokenEntity queryByToken(String token) { + return sysUserTokenDao.queryByToken(token); + } + + @Override + public SysUserEntity queryUser(String userId) { + return sysUserDao.selectById(userId); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysCaptchaServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysCaptchaServiceImpl.java new file mode 100644 index 0000000..cff92d4 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysCaptchaServiceImpl.java @@ -0,0 +1,65 @@ + + +package com.zcloud.modules.sys.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.code.kaptcha.Producer; +import com.zcloud.common.exception.ZException; +import com.zcloud.common.utils.DateUtils; +import com.zcloud.modules.sys.dao.SysCaptchaDao; +import com.zcloud.modules.sys.entity.SysCaptchaEntity; +import com.zcloud.modules.sys.service.SysCaptchaService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.awt.image.BufferedImage; +import java.util.Date; + +/** + * 验证码 + * + * + */ +@Service("sysCaptchaService") +public class SysCaptchaServiceImpl extends ServiceImpl implements SysCaptchaService { + @Autowired + private Producer producer; + + @Override + public BufferedImage getCaptcha(String uuid) { + if(StringUtils.isBlank(uuid)){ + throw new ZException("uuid不能为空"); + } + //生成文字验证码 + String code = producer.createText(); + + SysCaptchaEntity captchaEntity = new SysCaptchaEntity(); + captchaEntity.setUuid(uuid); + captchaEntity.setCode(code); + //5分钟后过期 + captchaEntity.setExpireTime(DateUtils.addDateMinutes(new Date(), 5)); + this.save(captchaEntity); + + return producer.createImage(code); + } + + @Override + public boolean validate(String uuid, String code) { + SysCaptchaEntity captchaEntity = this.getOne(new QueryWrapper().eq("uuid", uuid)); + if(captchaEntity == null){ + return false; + } + + //删除验证码 + this.removeById(uuid); + + if(captchaEntity.getCode().equalsIgnoreCase(code) && captchaEntity.getExpireTime().getTime() >= System.currentTimeMillis()){ + return true; + } + + return false; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysConfigServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysConfigServiceImpl.java new file mode 100644 index 0000000..71e1524 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysConfigServiceImpl.java @@ -0,0 +1,98 @@ + + +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.gson.Gson; +import com.zcloud.common.exception.ZException; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.Query; +import com.zcloud.modules.sys.dao.SysConfigDao; +import com.zcloud.modules.sys.entity.SysConfigEntity; +import com.zcloud.modules.sys.redis.SysConfigRedis; +import com.zcloud.modules.sys.service.SysConfigService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Map; + +@Service("sysConfigService") +public class SysConfigServiceImpl extends ServiceImpl implements SysConfigService { + @Autowired + private SysConfigRedis sysConfigRedis; + + @Override + public PageUtils queryPage(Map params) { + String paramKey = (String)params.get("paramKey"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + .like(StringUtils.isNotBlank(paramKey),"param_key", paramKey) + .eq("status", 1) + ); + + return new PageUtils(page); + } + + @Override + public void saveConfig(SysConfigEntity config) { + this.save(config); + sysConfigRedis.saveOrUpdate(config); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(SysConfigEntity config) { + this.updateById(config); + sysConfigRedis.saveOrUpdate(config); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateValueByKey(String key, String value) { + baseMapper.updateValueByKey(key, value); + sysConfigRedis.delete(key); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteBatch(String[] ids) { + for(String id : ids){ + SysConfigEntity config = this.getById(id); + sysConfigRedis.delete(config.getParamKey()); + } + + this.removeByIds(Arrays.asList(ids)); + } + + @Override + public String getValue(String key) { + SysConfigEntity config = sysConfigRedis.get(key); + if(config == null){ + config = baseMapper.queryByKey(key); + sysConfigRedis.saveOrUpdate(config); + } + + return config == null ? null : config.getParamValue(); + } + + @Override + public T getConfigObject(String key, Class clazz) { + String value = getValue(key); + if(StringUtils.isNotBlank(value)){ + return new Gson().fromJson(value, clazz); + } + + try { + return clazz.newInstance(); + } catch (Exception e) { + throw new ZException("获取参数失败"); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysDictionariesServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysDictionariesServiceImpl.java new file mode 100644 index 0000000..ee6a91b --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysDictionariesServiceImpl.java @@ -0,0 +1,184 @@ +package com.zcloud.modules.sys.service.impl; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.Query; +import com.zcloud.modules.sys.dao.SysDictionariesDao; +import com.zcloud.modules.sys.entity.SysDictionariesEntity; +import com.zcloud.modules.sys.service.SysDictionariesService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + + +@Service("sysDictionariesService") +public class SysDictionariesServiceImpl extends ServiceImpl implements SysDictionariesService { + + @Override + public PageUtils queryPage(Map params) { + params.put("sidx","order_by"); + params.put("order","asc"); + // String parentId = (String)params.get("parentId"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().eq("parent_id", "e725d2a91b8248f4b8f49889038df7de") + ); + + return new PageUtils(page); + } + + @Override + public List queryListParentId(String parentId) { + return baseMapper.queryListParentId(parentId); + } + + @Override + public List getAllList(String parentId){ + return this.getAlldictionariesList(parentId); + } + + @Override + public void delete(String dictionariesId){ + //删除菜单 + this.removeById(dictionariesId); + } + + @Override + public SysDictionariesEntity queryByBianma(String bianma){ + return this.baseMapper.selectOne(new QueryWrapper() + .eq("bianma",bianma)); + } + + @Override + public String getRecurrenceIds(String id){ + return this.baseMapper.getRecurrenceIds(id); + } + + @Override + public SysDictionariesEntity getByName(String name, String parentId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("name", name); + queryWrapper.eq("parent_id", parentId); + return baseMapper.selectOne(queryWrapper); + } + + /** + * 获取所有菜单列表 + */ + private List getAlldictionariesList(String parentId){ + //查询根菜单列表 + List dictionariesList = queryListParentId(parentId); + + //递归获取子菜单 + getdictionariesTreeList(dictionariesList); + + return dictionariesList; + } + + /** + * 递归 + */ + private List getdictionariesTreeList(List dictionariesList){ + List subdictionariesList = new ArrayList(); + + for(SysDictionariesEntity entity : dictionariesList){ + entity.setList(getdictionariesTreeList(queryListParentId(entity.getDictionariesId()))); + subdictionariesList.add(entity); + } + + return subdictionariesList; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void importAreaFromJson(){ + try { + BufferedReader br = new BufferedReader(new FileReader("D:\\educationWorkSpace\\untitled\\index_2022__level_5.json")); + String buf = br.readLine(); + StringBuffer json = new StringBuffer(); + while (buf != null) { + json.append(buf); + buf = br.readLine(); + } + List jsonList = (List) JSON.parse(json.toString()); + int porder = 0; + for (JSONObject provinces : jsonList) { + SysDictionariesEntity ppd = new SysDictionariesEntity(); + ppd.setDictionariesId(get32UUID()); //主键 + ppd.setName(provinces.getString("label")); + ppd.setBianma(provinces.getString("value").substring(0,9)); + ppd.setOrderBy(porder); + ppd.setParentId("e725d2a91b8248f4b8f49889038df7de"); + save(ppd); + porder++; + + int ciorder = 0; + for (JSONObject city : (List)provinces.get("children")){ + SysDictionariesEntity cipd = new SysDictionariesEntity(); + cipd.setDictionariesId(get32UUID()); //主键 + cipd.setName(city.getString("label")); + cipd.setBianma(city.getString("value").substring(0,9)); + cipd.setOrderBy(ciorder); + cipd.setParentId(ppd.getDictionariesId()); + save(cipd); + ciorder++; + + int corder = 0; + for (JSONObject county : (List)city.get("children")){ + SysDictionariesEntity cpd = new SysDictionariesEntity(); + cpd.setDictionariesId(get32UUID()); //主键 + cpd.setName(county.getString("label")); + cpd.setBianma(county.getString("value").substring(0,9)); + cpd.setOrderBy(corder); + cpd.setParentId(cipd.getDictionariesId()); + save(cpd); + + int vorder = 0; + for (JSONObject village : (List)county.get("children")){ + SysDictionariesEntity vpd = new SysDictionariesEntity(); + vpd.setDictionariesId(get32UUID()); //主键 + vpd.setName(village.getString("label")); + vpd.setBianma(village.getString("value").substring(0,9)); + vpd.setOrderBy(vorder); + vpd.setParentId(cpd.getDictionariesId()); + save(vpd); + vorder++; + + int order = 0; + for (JSONObject street : (List)village.get("children")){ + SysDictionariesEntity spd = new SysDictionariesEntity(); + spd.setDictionariesId(get32UUID()); //主键 + spd.setName(street.getString("label")); + spd.setBianma(street.getString("value").substring(0,9)); + spd.setOrderBy(vorder); + spd.setParentId(vpd.getDictionariesId()); + save(spd); + order ++; + } + } + } + } + } + System.out.println("=====================导入完成==================="); + }catch (Exception e){ + e.printStackTrace(); + } + } + + public static String get32UUID() { + String uuid = UUID.randomUUID().toString().trim().replaceAll("-", ""); + return uuid; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysLogServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysLogServiceImpl.java new file mode 100644 index 0000000..33e5bfb --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysLogServiceImpl.java @@ -0,0 +1,53 @@ + + +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.Query; +import com.zcloud.modules.sys.dao.SysLogDao; +import com.zcloud.modules.sys.entity.SysLogEntity; +import com.zcloud.modules.sys.service.SysLogService; +import org.apache.commons.lang.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.Date; +import java.util.Map; + + +@Service("sysLogService") +public class SysLogServiceImpl extends ServiceImpl implements SysLogService { + + @Override + public PageUtils queryPage(Map params) { + String key = (String)params.get("key"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().like(StringUtils.isNotBlank(key),"username", key) + ); + + return new PageUtils(page); + } + + @Override + public void saveLog(SysLogEntity logEntity) { + logEntity.setCreateDate(new Date()); + //计算表名 + String tableName = buildTableName(Calendar.getInstance().get(Calendar.YEAR)); + //如果表不存在,则创建 + if (!baseMapper.existsTable(tableName)){ + baseMapper.createTable(tableName); + } + //将日志插入到对应的表中 + baseMapper.insertIntoTable(logEntity, tableName); + } + + private String buildTableName(int year) { + // 构造表名 + return "sys_log_" + year; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysMenuServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysMenuServiceImpl.java new file mode 100644 index 0000000..40f32da --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysMenuServiceImpl.java @@ -0,0 +1,168 @@ + + +package com.zcloud.modules.sys.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.MapUtils; +import com.zcloud.modules.sys.dao.SysMenuDao; +import com.zcloud.modules.sys.entity.SysMenuEntity; +import com.zcloud.modules.sys.service.SysMenuService; +import com.zcloud.modules.sys.service.SysRoleMenuService; +import com.zcloud.modules.sys.service.SysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + + +@Service("sysMenuService") +public class SysMenuServiceImpl extends ServiceImpl implements SysMenuService { + @Autowired + private SysUserService sysUserService; + @Autowired + private SysRoleMenuService sysRoleMenuService; + + @Override + public List queryListParentId(Integer parentId, List menuIdList) { + List menuList = queryListParentId(parentId); + if(menuIdList == null){ + return menuList; + } + List userMenuList = new ArrayList<>(); + for(SysMenuEntity menu : menuList){ + if(menuIdList.contains(menu.getMenuId())){ + userMenuList.add(menu); + } + } + return userMenuList; + } + + @Override + public List queryListParentId(Integer parentId) { + return baseMapper.queryListParentId(parentId); + } + + @Override + public List queryNotButtonList(Integer parentId) { + return baseMapper.queryNotButtonList(parentId); + } + + @Override + public List getUserMenuList(String userId) { + //系统管理员,拥有最高权限 + if(userId.equals("1")){ + return getMenuList(null); + } + + //用户菜单列表 + List menuIdList = sysUserService.queryAllMenuId(userId); + return getMenuList(menuIdList); + } + + /** + * 获取拥有的菜单列表 + * @param menuIdList + * @return + */ + private List getMenuList(List menuIdList) { + // 查询拥有的所有菜单 + List menus = this.baseMapper.selectList(new QueryWrapper() + .in(Objects.nonNull(menuIdList), "menu_id", menuIdList).in("type", 0, 1).eq("is_delete",0)); + //查询完成 对此list直接排序 + Collections.sort(menus); + + // 将id和菜单绑定 + HashMap menuMap = new HashMap<>(12); + for (SysMenuEntity s : menus) { + menuMap.put(s.getMenuId(), s); + } + // 使用迭代器,组装菜单的层级关系 + Iterator iterator = menus.iterator(); + while (iterator.hasNext()) { + SysMenuEntity menu = iterator.next(); + SysMenuEntity parent = menuMap.get(menu.getParentId()); + if (Objects.nonNull(parent)) { + parent.getList().add(menu); + // 将这个菜单从当前节点移除 + iterator.remove(); + } + } + + return menus; + } + + @Override + @Transactional + public void delete(Integer menuId){ + + baseMapper.deleteById(menuId); + //删除菜单与角色关联 + sysRoleMenuService.removeByMap(new MapUtils().put("menu_id", menuId)); + } + + @Override + public List getAllList(Integer parentId){ + return this.getAllMenuList(parentId); + } + + @Override + public List getAllListNotButton(Integer parentId){ + return this.getAllMenuListNotButton(parentId); + } + + /** + * 获取所有菜单列表 + */ + private List getAllMenuList(Integer parentId){ + //查询根菜单列表 + List menuList = queryListParentId(parentId); + //递归获取子菜单 + getMenuTreeList(menuList); + + return menuList; + } + + /** + * 递归 + */ + private List getMenuTreeList(List menuList){ + List subMenuList = new ArrayList(); + + for(SysMenuEntity entity : menuList){ + entity.setList(getMenuTreeList(queryListParentId(entity.getMenuId()))); + subMenuList.add(entity); + } + + return subMenuList; + } + + /** + * 获取所有菜单列表(不包括按钮) + */ + private List getAllMenuListNotButton(Integer parentId){ + //查询根菜单列表 + List menuList = queryNotButtonList(parentId); + //递归获取子菜单 + getMenuTreeNotButtonList(menuList); + + return menuList; + } + + /** + * 递归 + */ + private List getMenuTreeNotButtonList(List menuList){ + List subMenuList = new ArrayList(); + + for(SysMenuEntity entity : menuList){ + entity.setList(getMenuTreeNotButtonList(queryNotButtonList(entity.getMenuId()))); + subMenuList.add(entity); + } + + return subMenuList; + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysRoleMenuServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysRoleMenuServiceImpl.java new file mode 100644 index 0000000..0a41f86 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysRoleMenuServiceImpl.java @@ -0,0 +1,52 @@ +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.modules.sys.dao.SysRoleMenuDao; +import com.zcloud.modules.sys.entity.SysRoleMenuEntity; +import com.zcloud.modules.sys.service.SysRoleMenuService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + + + +/** + * 角色与菜单对应关系 + * + * + */ +@Service("sysRoleMenuService") +public class SysRoleMenuServiceImpl extends ServiceImpl implements SysRoleMenuService { + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveOrUpdate(String roleId, List menuIdList) { + //先删除角色与菜单关系 + deleteBatch(new String[]{roleId}); + + if(menuIdList.size() == 0){ + return ; + } + + //保存角色与菜单关系 + for(Integer menuId : menuIdList){ + SysRoleMenuEntity sysRoleMenuEntity = new SysRoleMenuEntity(); + sysRoleMenuEntity.setMenuId(menuId); + sysRoleMenuEntity.setRoleId(roleId); + + this.save(sysRoleMenuEntity); + } + } + + @Override + public List queryMenuIdList(String roleId) { + return baseMapper.queryMenuIdList(roleId); + } + + @Override + public int deleteBatch(String[] roleIds){ + return baseMapper.deleteBatch(roleIds); + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysRoleServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..9de47eb --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,113 @@ + + +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.exception.ZException; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.common.utils.Query; +import com.zcloud.modules.sys.dao.SysRoleDao; +import com.zcloud.modules.sys.dao.SysUserDao; +import com.zcloud.modules.sys.entity.SysRoleEntity; +import com.zcloud.modules.sys.service.SysRoleMenuService; +import com.zcloud.modules.sys.service.SysRoleService; +import com.zcloud.modules.sys.service.SysUserRoleService; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 角色 + * + * + */ +@Service("sysRoleService") +public class SysRoleServiceImpl extends ServiceImpl implements SysRoleService { + @Autowired + private SysRoleMenuService sysRoleMenuService; + @Autowired + private SysUserDao sysUserDao; + @Autowired + private SysUserRoleService sysUserRoleService; + + @Override + public PageUtils queryPage(Map params) { + String roleName = (String)params.get("roleName"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + .like(StringUtils.isNotBlank(roleName),"role_name", roleName).orderByDesc("create_time") + ); + + return new PageUtils(page); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveRole(SysRoleEntity role) { + this.save(role); + + //检查权限是否越权 +// checkPrems(role); + + //保存角色与菜单关系 + sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(SysRoleEntity role) { + this.updateById(role); + + //检查权限是否越权 +// checkPrems(role); + + //更新角色与菜单关系 + sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteBatch(String[] roleIds) { + //删除角色 + this.removeByIds(Arrays.asList(roleIds)); + + //删除角色与菜单关联 + sysRoleMenuService.deleteBatch(roleIds); + + //删除角色与用户关联 + sysUserRoleService.deleteBatch(roleIds); + } + + + @Override + public List queryRoleIdList(String createUserId) { + return baseMapper.queryRoleIdList(createUserId); + } + + /** + * 检查权限是否越权 + */ + private void checkPrems(SysRoleEntity role){ + //如果不是超级管理员,则需要判断角色的权限是否超过自己的权限 + if(role.getCreator().equals("1")){ + return ; + } + + //查询用户所拥有的菜单列表 + List menuIdList = sysUserDao.queryAllMenuId(role.getCreator()); + + //判断是否越权 + if(!menuIdList.containsAll(role.getMenuIdList())){ + throw new ZException("新增角色的权限,已超出你的权限范围"); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserRoleServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserRoleServiceImpl.java new file mode 100644 index 0000000..eaf6f81 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserRoleServiceImpl.java @@ -0,0 +1,52 @@ + + +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.MapUtils; +import com.zcloud.modules.sys.dao.SysUserRoleDao; +import com.zcloud.modules.sys.entity.SysUserRoleEntity; +import com.zcloud.modules.sys.service.SysUserRoleService; +import org.springframework.stereotype.Service; + +import java.util.List; + + + +/** + * 用户与角色对应关系 + * + * + */ +@Service("sysUserRoleService") +public class SysUserRoleServiceImpl extends ServiceImpl implements SysUserRoleService { + + @Override + public void saveOrUpdate(String userId, List roleIdList) { + //先删除用户与角色关系 + this.removeByMap(new MapUtils().put("user_id", userId)); + + if(roleIdList == null || roleIdList.size() == 0){ + return ; + } + + //保存用户与角色关系 + for(String roleId : roleIdList){ + SysUserRoleEntity sysUserRoleEntity = new SysUserRoleEntity(); + sysUserRoleEntity.setUserId(userId); + sysUserRoleEntity.setRoleId(roleId); + + this.save(sysUserRoleEntity); + } + } + + @Override + public List queryRoleIdList(String userId) { + return baseMapper.queryRoleIdList(userId); + } + + @Override + public int deleteBatch(String[] roleIds){ + return baseMapper.deleteBatch(roleIds); + } +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..13ae6a1 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserServiceImpl.java @@ -0,0 +1,134 @@ +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.PageUtils; +import com.zcloud.modules.sys.dao.SysUserDao; +import com.zcloud.modules.sys.entity.SysUserEntity; +import com.zcloud.modules.sys.service.SysDictionariesService; +import com.zcloud.modules.sys.service.SysUserRoleService; +import com.zcloud.modules.sys.service.SysUserService; +import org.apache.shiro.crypto.hash.Sha256Hash; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.regex.Pattern; + + +/** + * 系统用户 + */ +@Service("sysUserService") +public class SysUserServiceImpl extends ServiceImpl implements SysUserService { + @Autowired + private SysUserRoleService sysUserRoleService; + + + @Override + public PageUtils queryPage(Map params) { + Page> page = new Page<>(Integer.parseInt(params.get("curPage").toString()), Integer.parseInt(params.get("limit").toString())); + params.put("isDelete", 0); + IPage ipage = baseMapper.listPage(page, params); + return new PageUtils(ipage); + } + + @Override + public SysUserEntity queryById(String userId) { + return baseMapper.queryById(userId); + } + + @Override + public List queryAllPerms(String userId) { + return baseMapper.queryAllPerms(userId); + } + + @Override + public List queryAllMenuId(String userId) { + return baseMapper.queryAllMenuId(userId); + } + + @Override + public SysUserEntity queryByUserName(String username) { + return baseMapper.queryByUserName(username); + } + + @Override + @Transactional + public void saveUser(SysUserEntity user) { + user.setStatus(1); + //sha256加密 + user.setPassword(new Sha256Hash("666666", user.getUsername()).toHex()); + this.save(user); + + } + + @Override + @Transactional + public void update(SysUserEntity user) { + + user.setPassword(new Sha256Hash("Aqsc@2024", user.getUsername()).toHex()); + this.updateById(user); + + } + + + @Override + public boolean updatePassword(String userId, String password, String newPassword) { + SysUserEntity userEntity = new SysUserEntity(); + userEntity.setPassword(newPassword); + return this.update(userEntity, + new QueryWrapper().eq("user_id", userId).eq("password", password)); + } + + @Override + public List listAll(Map params) { + return baseMapper.listAll(params); + } + + @Override + public List listForSelect(Map params){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.ne("user_id","1"); + queryWrapper.isNull("corpinfo_id"); + return baseMapper.selectList(queryWrapper); + } + + private String get32UUID() { + String uuid = UUID.randomUUID().toString().trim().replaceAll("-", ""); + return uuid; + } + + /** + * 校验手机号 + * + * @param phoneNumber + * @return + */ + public static boolean isValidPhoneNumber(String phoneNumber) { + if ((phoneNumber != null) && (!phoneNumber.isEmpty())) { + return Pattern.matches("^1[3-9]\\d{9}$", phoneNumber); + } + return false; + } + + /** + * 校验邮箱 + * + * @param email + * @return + */ + public static boolean isValidEmail(String email) { + if ((email != null) && (!email.isEmpty())) { + return Pattern.matches("^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$", email); + } + return false; + } + +} diff --git a/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserTokenServiceImpl.java b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserTokenServiceImpl.java new file mode 100644 index 0000000..122344a --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/modules/sys/service/impl/SysUserTokenServiceImpl.java @@ -0,0 +1,83 @@ +package com.zcloud.modules.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zcloud.common.utils.R; +import com.zcloud.modules.sys.dao.SysUserTokenDao; +import com.zcloud.modules.sys.entity.SysUserTokenEntity; +import com.zcloud.modules.sys.oauth2.TokenGenerator; +import com.zcloud.modules.sys.service.SysUserTokenService; +import org.springframework.stereotype.Service; + +import java.util.Date; + + +@Service("sysUserTokenService") +public class SysUserTokenServiceImpl extends ServiceImpl implements SysUserTokenService { + //shiro失效时间30分钟 + private final static int EXPIRE = 1800; + + + @Override + public R createToken(String userId) { + //生成一个token + String token = TokenGenerator.generateValue(); + + //当前时间 + Date now = new Date(); + //过期时间 + Date expireTime = new Date(now.getTime() + EXPIRE * 1000); + + //判断是否生成过token + SysUserTokenEntity tokenEntity = this.getById(userId); + if(tokenEntity == null){ + tokenEntity = new SysUserTokenEntity(); + tokenEntity.setUserId(userId); + tokenEntity.setToken(token); + tokenEntity.setUpdateTime(now); + tokenEntity.setExpireTime(expireTime); + + //保存token + this.save(tokenEntity); + }else{ + tokenEntity.setToken(token); + tokenEntity.setUpdateTime(now); + tokenEntity.setExpireTime(expireTime); + + //更新token + this.updateById(tokenEntity); + } + + R r = R.ok().put("token", token).put("expire", EXPIRE); + + return r; + } + + @Override + public void logout(String userId) { + //生成一个token + String token = TokenGenerator.generateValue(); + + //修改token + SysUserTokenEntity tokenEntity = new SysUserTokenEntity(); + tokenEntity.setUserId(userId); + tokenEntity.setToken(token); + this.updateById(tokenEntity); + } + + @Override + public void refreshToken(String userId){ + //当前时间 + Date now = new Date(); + //过期时间 + Date expireTime = new Date(now.getTime() + EXPIRE * 1000); + + //判断是否生成过token + SysUserTokenEntity tokenEntity = this.getById(userId); + + tokenEntity.setUpdateTime(now); + tokenEntity.setExpireTime(expireTime); + + //更新token + this.updateById(tokenEntity); + } +} diff --git a/review_repo/src/main/java/com/zcloud/task/AnemometerTask.java b/review_repo/src/main/java/com/zcloud/task/AnemometerTask.java new file mode 100644 index 0000000..af10d18 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/task/AnemometerTask.java @@ -0,0 +1,140 @@ +package com.zcloud.task; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.zcloud.common.utils.DateUtil; +import com.zcloud.modules.alarmInfo.entity.AlarmInfoEntity; +import com.zcloud.modules.alarmInfo.service.AlarmInfoService; +import com.zcloud.modules.anemometerMachine.entity.AnemometerMachineEntity; +import com.zcloud.modules.anemometerMachine.service.AnemometerMachineService; +import com.zcloud.modules.anemometerRecord.entity.AnemometerRecordEntity; +import com.zcloud.modules.anemometerRecord.mapper.AnemometerRecordMapper; +import com.zcloud.modules.job.task.ITask; +import com.zcloud.modules.sys.entity.PageData; +import com.zcloud.util.HttpClientUtil; +import com.zcloud.util.UuidUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component("aemometerTask") +public class AnemometerTask implements ITask { + @Autowired + private AnemometerMachineService anemometerMachineService; + @Autowired + private AnemometerRecordMapper anemometerRecordMapper; + @Autowired + private AlarmInfoService alarmInfoService; + static String anemometerUrl = "http://192.168.210.58:8076/zk-ht/third/outNet/getUnloadShipWindList"; + + @Override + public void run(String params) { + Map map = HttpClientUtil.doPost(anemometerUrl, new HashMap<>()); + ArrayList> list = (ArrayList>) map.get("list"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AnemometerMachineEntity::getCorpinfoId,"8854edee3aa94be496cee676b6d4845a"); + List dataList = anemometerMachineService.list(queryWrapper); + List addList = new ArrayList<>(); + List updateList = new ArrayList<>(); + List recordList = new ArrayList<>(); + for (Map data : list) { + boolean flag = false; + if (dataList.size() > 0) { + for (AnemometerMachineEntity machine : dataList) { + if (machine.getAnemometerName().equals(data.get("machine"))) { + AnemometerRecordEntity anemometerRecordEntity = new AnemometerRecordEntity(); + anemometerRecordEntity.setAnemometerId(machine.getAnemometerId()); + anemometerRecordEntity.setAnemometerRecordId(UuidUtil.get32UUID()); + anemometerRecordEntity.setCREATOR("5c61afed41bc4c25acf77aed1391e666"); + anemometerRecordEntity.setCREATTIME(DateUtil.date2Str(new Date())); + anemometerRecordEntity.setOPERATOR("5c61afed41bc4c25acf77aed1391e666"); + anemometerRecordEntity.setOPERATTIME(DateUtil.date2Str(new Date())); + anemometerRecordEntity.setVALUE(String.valueOf(data.get("data"))); + anemometerRecordEntity.setDATE(data.get("fdate").toString()); + anemometerRecordEntity.setAnemometerName(machine.getAnemometerName()); + anemometerRecordEntity.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + + machine.setOPERATOR("5c61afed41bc4c25acf77aed1391e666"); + machine.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + machine.setOPERATTIME(DateUtil.date2Str(new Date())); + updateList.add(machine); + recordList.add(anemometerRecordEntity); + + flag = true; + } + } + } + if (flag) { + continue; + } + AnemometerMachineEntity machine = new AnemometerMachineEntity(); + machine.setAnemometerId(UuidUtil.get32UUID()); + machine.setAnemometerName(data.get("machine").toString()); + machine.setCREATOR("5c61afed41bc4c25acf77aed1391e666"); + machine.setCREATTIME(DateUtil.date2Str(new Date())); + machine.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + machine.setOPERATOR("5c61afed41bc4c25acf77aed1391e666"); + machine.setOPERATTIME(DateUtil.date2Str(new Date())); + + AnemometerRecordEntity anemometerRecordEntity = new AnemometerRecordEntity(); + anemometerRecordEntity.setAnemometerId(machine.getAnemometerId()); + anemometerRecordEntity.setAnemometerRecordId(UuidUtil.get32UUID()); + anemometerRecordEntity.setCREATOR("5c61afed41bc4c25acf77aed1391e666"); + anemometerRecordEntity.setCREATTIME(DateUtil.date2Str(new Date())); + anemometerRecordEntity.setOPERATOR("5c61afed41bc4c25acf77aed1391e666"); + anemometerRecordEntity.setOPERATTIME(DateUtil.date2Str(new Date())); + anemometerRecordEntity.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + anemometerRecordEntity.setVALUE(String.valueOf(data.get("data"))); + anemometerRecordEntity.setDATE(data.get("fdate").toString()); + anemometerRecordEntity.setAnemometerName(machine.getAnemometerName()); + + addList.add(machine); + recordList.add(anemometerRecordEntity); + } + if (addList.size() > 0) { + anemometerMachineService.saveBatch(addList); + } + if (recordList.size() > 0) { + anemometerRecordMapper.insert(recordList); + } + List alarmList = new ArrayList<>(); + //查询风速仪报警阈值 + PageData tPd = new PageData(); + tPd.put("DICT_NAME","风速仪"); + List levelList = alarmInfoService.findThreshold(tPd); + + for (AnemometerRecordEntity anemometerRecord : recordList) { + //若风速大于阈值则存储报警信息 + for (PageData data : levelList) { + if (Double.parseDouble(anemometerRecord.getVALUE()) > Double.parseDouble(data.getString("LEVELVALUE"))) { + AlarmInfoEntity alarmInfoEntity = new AlarmInfoEntity(); + alarmInfoEntity.setAlarmInfoId(UuidUtil.get32UUID()); + alarmInfoEntity.setAlarmValue(anemometerRecord.getVALUE()); + alarmInfoEntity.setAlarmTime(DateUtil.date2Str(new Date())); + alarmInfoEntity.setLEVEL(data.getString("LEVELNAME")); + alarmInfoEntity.setCREATOR("5c61afed41bc4c25acf77aed1391e666"); + alarmInfoEntity.setCREATTIME(DateUtil.date2Str(new Date())); + alarmInfoEntity.setOPERATOR("5c61afed41bc4c25acf77aed1391e666"); + alarmInfoEntity.setOPERATTIME(DateUtil.date2Str(new Date())); + alarmInfoEntity.setISDELETE("0"); + alarmInfoEntity.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + alarmInfoEntity.setLOG(anemometerRecord.getAnemometerName()+"风速达到"+anemometerRecord.getVALUE()+",米/秒,已经达到"+data.getString("LEVELNAME")+"阈值"); + alarmInfoEntity.setAnemometerId(anemometerRecord.getAnemometerId()); + alarmList.add(alarmInfoEntity); + break; + } + } + } + if (alarmList.size() > 0) { + alarmInfoService.saveBatch(alarmList); + } + if (updateList.size() > 0) { + for (AnemometerMachineEntity updatePd : updateList) { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(AnemometerMachineEntity::getAnemometerName,updatePd.getAnemometerName()); + anemometerMachineService.update(updatePd, updateWrapper); + } + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/task/CarAndPersonScheduledTasks.java b/review_repo/src/main/java/com/zcloud/task/CarAndPersonScheduledTasks.java new file mode 100644 index 0000000..5d500f8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/task/CarAndPersonScheduledTasks.java @@ -0,0 +1,148 @@ +package com.zcloud.task; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.modules.djCarLog.entity.DjCarLogEntity; +import com.zcloud.modules.djCarLog.mapper.DjCarLogMapper; +import com.zcloud.modules.djPersonLog.entity.DjPersonLogEntity; +import com.zcloud.modules.djPersonLog.mapper.DjPersonLogMapper; +import com.zcloud.modules.job.task.ITask; +import com.zcloud.util.PerLocUtil; +import com.zcloud.util.ThreadPoolUtils; +import com.zcloud.util.UuidUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.concurrent.ExecutorService; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + * 闸机进出数据对接 + */ +@Component("carAndPersonScheduledTasks") +public class CarAndPersonScheduledTasks implements ITask { + + @Autowired + private PerLocUtil perLocUtil; + + @Resource + private DjCarLogMapper djCarLogMapper; + + @Resource + private DjPersonLogMapper djPersonLogMapper; + + + ExecutorService threadPool = ThreadPoolUtils.getThreadPoolService(); + + //正式使用 + static String CAR_URL = "http://192.168.210.32:8084/region/access/bayonetVehicleEntryAndExitRecords?"; + + static String PERSON_URL = "http://192.168.210.32:8084/region/access/bayonetPersonnelEntryAndExitRecords?"; + + @Override + public void run(String params) { + carTask(); + personTask(); + } + + public void carTask() { + threadPool.execute(() -> { + try { + //开始时间为当前时间前10分钟 + String initialDates = formatDateTime(LocalDateTime.now().plusMinutes(-10)); + //结束时间为当前时间前5分钟 + String updatedDates = formatDateTime(LocalDateTime.now().plusMinutes(-5)); + MultiValueMap paramMap = new LinkedMultiValueMap(); + paramMap.add("beginTime", initialDates); + paramMap.add("endTime", updatedDates); + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + + String url = CAR_URL+"fstartDate="+initialDates+"&fendDate="+updatedDates+"&carsign=&accId=&entrystatus=&cartype="; + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); + + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if(responseObject.get("code") != null && responseObject.get("code").toString().equals("200") ){ + List varList = JSONObject.parseArray(JSON.toJSON(responseObject.get("data")).toString(), DjCarLogEntity.class); + varList.forEach(item -> { + item.setCarLogId(UuidUtil.get32UUID()); + item.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + }); + djCarLogMapper.insert(varList); + } + } else { + // 处理非成功状态码的情况 + System.out.println("Request failed with status code: " + response.getStatusCode()); + } + } catch (Exception e) { + e.printStackTrace(); + } + }); + } + + public void personTask() { + threadPool.execute(() -> { + try { + //开始时间为当前时间前10分钟 + String initialDates = formatDateTime(LocalDateTime.now().plusMinutes(-10)); + //结束时间为当前时间前5分钟 + String updatedDates = formatDateTime(LocalDateTime.now().plusMinutes(-5)); + MultiValueMap paramMap = new LinkedMultiValueMap(); + paramMap.add("beginTime", initialDates); + paramMap.add("endTime", updatedDates); + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", perLocUtil.getToken()); + HttpEntity entity = new HttpEntity<>(headers); + + String url = PERSON_URL+"fstartDate="+initialDates+"&fendDate="+updatedDates+"&empNo=&empId=&entrystatus=&accId="; + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); + if (response.getStatusCode().is2xxSuccessful()) { + String responseBody = response.getBody(); // 获取响应体字符串 + JSONObject responseObject = JSONObject.parseObject(responseBody); + if(responseObject.get("code") != null && responseObject.get("code").toString().equals("200") ){ + List varList = JSONObject.parseArray(JSON.toJSON(responseObject.get("data")).toString(), DjPersonLogEntity.class); + varList.forEach(item -> { + item.setPersonLogId(UuidUtil.get32UUID()); + item.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); + }); + djPersonLogMapper.insert(varList); + } + } else { + // 处理非成功状态码的情况 + System.out.println("Request failed with status code: " + response.getStatusCode()); + } + } catch (Exception e) { + e.printStackTrace(); + } + }); + } + + private static String formatDateTime(LocalDateTime dateTime) { + if (dateTime == null) { + return "null"; + } + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + return dateTime.format(formatter); + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/task/DoorSaveTask.java b/review_repo/src/main/java/com/zcloud/task/DoorSaveTask.java new file mode 100644 index 0000000..6607d5e --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/task/DoorSaveTask.java @@ -0,0 +1,129 @@ +package com.zcloud.task; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.zcloud.common.utils.DateUtil; +import com.zcloud.modules.job.task.ITask; +import com.zcloud.modules.mkmjDoor.entity.MkmjDoorEntity; +import com.zcloud.modules.mkmjDoor.mapper.MkmjDoorMapper; +import com.zcloud.util.UuidUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.*; + +/** + * 口门数据对接 每天1:00更新 + */ +@Component("doorSaveTask") +public class DoorSaveTask implements ITask { + @Value("${perLoc.url}") + private String url; + @Autowired + private RestTemplate restTemplate; + @Autowired + private MkmjDoorMapper mkmjDoorMapper; + + @Override + public void run(String params) { + try { + scheduled(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +// @Scheduled(cron ="*/30 * * * * ?")//测试 + // @Scheduled(cron ="0 0 1 * * ?")//每天凌晨一点执行一次 + public void scheduled() throws Exception {; + List allList = new ArrayList<>(); + String type = "0"; + Map result = restTemplate.getForObject(url+"/region/access/obtainBayonetData?type="+type, Map.class); + Object msg = result.get("msg"); + if (msg!=null && msg.equals("success")){ + ArrayList> data = (ArrayList>)result.get("data"); + for (LinkedHashMap linkedHashMap : data){ + MkmjDoorEntity mkmjDoorEntity = new MkmjDoorEntity(); + mkmjDoorEntity.setDoorId(UuidUtil.get32UUID()); + mkmjDoorEntity.setDooreType(Integer.valueOf(linkedHashMap.get("type").toString())); + mkmjDoorEntity.setSTATUS(0); + mkmjDoorEntity.setDoorName(linkedHashMap.get("name").toString()); + mkmjDoorEntity.setLONGITUDE(linkedHashMap.get("longitude").toString()); + mkmjDoorEntity.setLATITUDE(linkedHashMap.get("latitude").toString()); + mkmjDoorEntity.setSourceId(linkedHashMap.get("id").toString()); + mkmjDoorEntity.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); // 添加企业ID + mkmjDoorEntity.setCREATOR( "5c61afed41bc4c25acf77aed1391e666"); // 添加人 + mkmjDoorEntity.setCREATTIME( DateUtil.date2Str(new Date())); // 添加时间 + mkmjDoorEntity.setISDELETE("0"); //是否删除 + mkmjDoorEntity.setOPERATOR( "5c61afed41bc4c25acf77aed1391e666"); //修改人 + mkmjDoorEntity.setOPERATTIME( DateUtil.date2Str(new Date()));//修改时间 + allList.add(mkmjDoorEntity); + } + } + type = "1"; + Map result2 = restTemplate.getForObject(url+"/region/access/obtainBayonetData?type="+type, Map.class); + Object msg2 = result2.get("msg"); + if (msg2!=null && msg2.equals("success")){ + ArrayList> data = (ArrayList>)result2.get("data"); + for (LinkedHashMap linkedHashMap : data){ + MkmjDoorEntity mkmjDoorEntity = new MkmjDoorEntity(); + mkmjDoorEntity.setDoorId( UuidUtil.get32UUID()); + mkmjDoorEntity.setDooreType(Integer.valueOf(linkedHashMap.get("type").toString())); + mkmjDoorEntity.setSTATUS(0); + mkmjDoorEntity.setDoorName(linkedHashMap.get("name").toString()); + mkmjDoorEntity.setLONGITUDE(linkedHashMap.get("longitude").toString()); + mkmjDoorEntity.setLATITUDE(linkedHashMap.get("latitude").toString()); + mkmjDoorEntity.setSourceId(linkedHashMap.get("id").toString()); + mkmjDoorEntity.setCorpinfoId("8854edee3aa94be496cee676b6d4845a"); // 添加企业ID + mkmjDoorEntity.setCREATOR( "5c61afed41bc4c25acf77aed1391e666"); // 添加人 + mkmjDoorEntity.setCREATTIME( DateUtil.date2Str(new Date())); // 添加时间 + mkmjDoorEntity.setISDELETE("0"); //是否删除 + mkmjDoorEntity.setOPERATOR( "5c61afed41bc4c25acf77aed1391e666"); //修改人 + mkmjDoorEntity.setOPERATTIME( DateUtil.date2Str(new Date()));//修改时间 + boolean flag = true; + for (MkmjDoorEntity p : allList) { + if (p.getDoorName().equals(mkmjDoorEntity.getDoorName())){ + flag = false; + } + } + if (flag) { + allList.add(mkmjDoorEntity); + } + } + } + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(MkmjDoorEntity::getCorpinfoId,"8854edee3aa94be496cee676b6d4845a"); + List dataList = mkmjDoorMapper.selectList(lambdaQueryWrapper); + List addList = new ArrayList<>(); + ArrayList updateList = new ArrayList<>(); + addList.addAll(allList); + if (dataList.size()>0) { + for (MkmjDoorEntity mkmjDoorEntity : dataList) { + for (MkmjDoorEntity data : allList) { + if (mkmjDoorEntity.getSourceId().equals(data.getSourceId()) && mkmjDoorEntity.getDoorName().equals(data.getDoorName())) { + updateList.add(data); + addList.remove(data); + continue; + } + } + } + } + if (addList.size()>0) { + mkmjDoorMapper.insert(addList); + } + if (updateList.size()>0) { + for(MkmjDoorEntity mkmjDoorEntity : updateList){ + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(MkmjDoorEntity::getSourceId,mkmjDoorEntity.getSourceId()); + mkmjDoorMapper.update(mkmjDoorEntity,updateWrapper); + } + } + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/task/RyCheckMbTask.java b/review_repo/src/main/java/com/zcloud/task/RyCheckMbTask.java new file mode 100644 index 0000000..07d0a9f --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/task/RyCheckMbTask.java @@ -0,0 +1,20 @@ +package com.zcloud.task; + + +import com.zcloud.modules.RyCheck.service.RyCheckService; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashSet; + +@Component("ryCheckMbTask") +public class RyCheckMbTask { + + @Resource + private RyCheckService ryCheckService; + + // @Scheduled(cron = "0 0 0 1/1 * ? ") + public void checkRyMb() { + ryCheckService.getRyCheckRyMbList(); + } +} diff --git a/review_repo/src/main/java/com/zcloud/task/RyCheckTask.java b/review_repo/src/main/java/com/zcloud/task/RyCheckTask.java new file mode 100644 index 0000000..d7cf4b8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/task/RyCheckTask.java @@ -0,0 +1,28 @@ +package com.zcloud.task; + + +import com.zcloud.modules.RyCheck.service.RyCheckService; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashSet; + +@Component("ryCheckTask") +public class RyCheckTask { + + @Resource + private RyCheckService ryCheckService; + + + // @Scheduled(cron = "0 0 0/1 * * ? ") + public void checkRyJl() { + ryCheckService.getRyCheckJlList(); + } + // @Scheduled(cron = "0 0 0/1 * * ? ") + public void checkRyJh() { + ryCheckService.getRyCheckJhList(); + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/util/BaseResultInterface.java b/review_repo/src/main/java/com/zcloud/util/BaseResultInterface.java new file mode 100644 index 0000000..cff9df8 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/BaseResultInterface.java @@ -0,0 +1,18 @@ +package com.zcloud.util; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ +/** + * @desc 对象返回到前端以及异常抛出的接口类 + */ +public interface BaseResultInterface { + + + String getCode(); + + + String getMessage(); +} diff --git a/review_repo/src/main/java/com/zcloud/util/BizException.java b/review_repo/src/main/java/com/zcloud/util/BizException.java new file mode 100644 index 0000000..3b26f15 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/BizException.java @@ -0,0 +1,84 @@ +package com.zcloud.util; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ + +public class BizException extends RuntimeException implements BaseResultInterface { + + private static final long serialVersionUID = 1L; + + + /** + * 错误码 + */ + private String code; + + /** + * 错误信息 + */ + private String message; + + public BizException() { + super(); + } + + public BizException(CodeMessageEnum codeMessageEnum) { + super(codeMessageEnum.getCode(),new Throwable()); + this.code = codeMessageEnum.getCode(); + this.message = codeMessageEnum.getMessage(); + } + + public BizException(CodeMessageEnum codeMessageEnum, Throwable cause) { + super(codeMessageEnum.getCode(), cause); + this.code = codeMessageEnum.getCode(); + this.message = codeMessageEnum.getMessage(); + } + public BizException(CodeMessageEnum codeMessageEnum, Throwable cause, String details) { + super(codeMessageEnum.getCode(), cause); + this.code = codeMessageEnum.getCode(); + this.message = codeMessageEnum.getMessage() + details; + } + public BizException(CodeMessageEnum codeMessageEnum, String message, Throwable cause) { + super(codeMessageEnum.getCode(), cause); + this.code = codeMessageEnum.getCode(); + this.message = message; + } + + public BizException(String message) { + super(message); + this.message = message; + } + + public BizException(String code, String message) { + super(code); + this.code = code; + this.message = message; + } + + public BizException(String code, String message, Throwable cause) { + super(code, cause); + this.code = code; + this.message = message; + } + + @Override + public Throwable fillInStackTrace() { + return this; + } + + + @Override + public String getCode() { + return this.code; + } + + @Override + public String getMessage() { + return this.message; + } +} + + diff --git a/review_repo/src/main/java/com/zcloud/util/CodeMessageEnum.java b/review_repo/src/main/java/com/zcloud/util/CodeMessageEnum.java new file mode 100644 index 0000000..445aa28 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/CodeMessageEnum.java @@ -0,0 +1,197 @@ +package com.zcloud.util; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ +public enum CodeMessageEnum implements BaseResultInterface { + + /** ********* 0000成功 *************** */ + SUCCESS("0000", "成功!"), + SUCCESS_LOGIN("0001", "用户登录成功"), + SUCCESS_LOGOUT("0002", "用户退出成功"), + + /* 默认失败 */ + COMMON_FAIL("999", "失败"), + + /** ********* 1xxx系统错误 *************** */ + SERVER_BUSY("1001", "服务器正忙,请稍后再试!"), + INTERNAL_SERVER_ERROR("1002", "服务器内部错误"), + NOT_FOUND("1003", "未找到该资源!"), + REQUEST_METHOD_ERROR("1004", "接口请求方法异常"), + SQL_SYNTAX_ERROR_EXCEPTION("1005", "SQL语法错误异常"), + NULL_POINT_ERROR_EXCEPTION("1006", "空指针异常信息"), + INNER_FRAME_EXCEPTION("1007", "内部框架执行异常"), + PARSE_TOKEN_EXCEPTION("1008", "解析token异常"), + TOKEN_NOT_EXIST("1009", "token不存在"), + TOKEN_SIGNATURE_EXCEPTION("1010", "token签名异常"), + TOKEN_EXPIRE("1011", "token过期,请重新登录"), + IMG_TYPE_NOT_CONFIG("1012", "请配置图片类型"), + NOT_CONFIG_FILE_DIR("1013", "请配置文件路径"), + UPLOAD_FILE_ERROR("1014", "文件上传失败"), + FILE_NOT_EXIST("1015", "文件不存在"), + FILE_HAS_DELETED("1016", "文件已被删除"), + DRIVER_CLASS_NOT_FOUND("1017", "数据库的连接驱动正在加载中..."), + TRY_CONNECT_DATABASE_ERROR("1018", "尝试连接数据库失败"), + CLOSE_CONNECT_DATABASE_ERROR("1019", "关闭数据库连接失败"), + DATABASE_NAME_NOT_EXIST("1020", "数据库名称不存在"), + CLOSE_DATASOURCE_ERROR("1021", "释放数据库资源异常"), + DRUID_DATASOURCE_ERROR("1022", "数据源创建中..."), + CREATE_DATABASE_ERROR("1023", "创建数据库失败"), + CREATE_TABLE_ERROR("1024", "创建表失败"), + UPDATE_TABLE_FIELD_ERROR("1025", "更新表字段失败"), + DELETE_TABLE_FIELD_ERROR("1026", "删除表字段失败"), + QUERY_ROLE_ERROR("1027", "查询角色失败"), + UPDATE_GROUP_ERROR("1028", "更新接口组失败"), + DELETE_GROUP_ERROR("1029", "删除接口组失败"), + SAVE_INTERFACE_ERROR("1030", "保存接口信息失败"), + + /** + * ******2xxx参数错误 ********************* + */ + BODY_NOT_MATCH("2001", "请求的数据格式不符"), + SIGNATURE_NOT_MATCH("2002", "请求的数字签名不匹配!"), + REQUEST_PATH_NOT_MATCH("2003", "当前请求路径没有权限!"), + NOT_UPLOAD_FILE_NAME_ERROR("2004", "上传的文件名不存在,请重新上传"), + NOT_SUPPORT_IMG_TYPE("2005", "图片格式不正确,请重新上传"), + NOT_SUPPORT_USERNAME_TYPE("2006", "excel用户名不能为空"), + NOT_SUPPORT_ROLE_TYPE("2007", "角色不存在"), + NOT_SUPPORT_DEPT_TYPE("2008", "部门不存在"), + SQL_INJECT_NOT_ALLOWED("2009", "参数中存在数据库关键字,请修改"), + TABLE_FIELD_NOT_EXIST("2010", "表字段不存在"), + FILE_PICTURE_IS_NULL("2011", "附件不存在"), + FILE_PICTURE_DELETE("2012", "删除附件失败"), + DIC_BIANMA_REPEAT("2013", "字典编码重复"), + + + + + + /** *********** 3xxx用户错误 ******************* */ + USER_NOT_LOGIN("3001", "用户未登录"), + USER_ACCOUNT_EXPIRED("3002", "账号已过期"), + USER_CREDENTIALS_ERROR("3003", "用户名或密码错误"), + USER_CREDENTIALS_EXPIRED("3004", "密码过期"), + USER_ACCOUNT_NOT_BIND_ENTERPRISE("3005", "当前账号未绑定企业"), + USER_ACCOUNT_LOCKED("3006", "账号被锁定"), + USER_ACCOUNT_NOT_EXIST("3007", "账号不存在"), + USER_ACCOUNT_ALREADY_EXIST("3008", "账号已存在"), + USER_ACCOUNT_USE_BY_OTHERS("3009", "账号下线"), + USER_NO_PERMISSION("3010", "当前账号没有此权限"), + USERNAME_NOT_BLANK("3011", "用户不能为空"), + USER_LOGIN_ERROR("3012", "用户登录失败"), + USER_LOGOUT_ERROR("3013", "用户退出失败"), + USER_ACCOUNT_USE_BY_OTHERS_ERROR("3014", "账号下线异常"), + USER_ACCESS_DENIED("3015", "权限认证失败"), + USERNAME_EXIST_ERROR("3016", "用户名重名"), + + ROLE_NAME_ALREADY_EXIST("3101", "角色已存在"), + + /** ********** 4xxx业务错误 *********************** */ + ENTERPRISE_NOT_EXIST("4001", "当前企业不存在"), + APP_KEY_EXIST("4002", "应用key已存在"), + APP_NOT_EXIST("4003", "应用不存在"), + APP_PAGE_NAME_EXIST("4004", "当前页面名称已存在"), + APP_PAGE_KEY_EXIST("4005", "当前页面key已存在"), + APP_PAGE_NOT_EXIST("4006", "当前页面不存在,或已删除"), + APP_PAGE_TYPE_ERROR("4007", "页面类型有误"), + APP_PAGE_HOME_IS_NOT_EXIST("4008", "请设置首页"), + CAN_NOT_DELETE_HOME_PAGE("4009", "请勿删除首页"), + DELETE_PAGE_ERROR("4010", "删除页面失败"), + CONFIG_CUSTOM_ERROR("4011", "配置自定义页面失败"), + APP_PAGE_PARENT_NOT_EXIST("4012", "当前页面的父级页面不存在,或已删除"), + DATASOURCE_NAME_EXIST("4013", "当前数据源名称已经存在,请修改后重试"), + DATASOURCE_NOT_EXIST("4014", "当前数据源不存在"), + DATASOURCE_HAS_DELETED("4015", "当前数据源已删除"), + MODEL_NOT_EXIST("4016", "当前模型不存在"), + MODEL_HAS_DELETED("4017", "当前模型已删除"), + MODEL_NAME_HAS_EXIST("4018", "当前模型名称已存在"), + DATASOURCE_NOT_CONFIG("4019", "数据源配置为空,请联系管理员"), + DATASOURCE_NOT_CONFIG_DIALECT("4020", "未配置数据源的类型"), + DATASOURCE_NOT_CONFIG_DRIVER_CLASS_NAME("4021", "未配置数据源的驱动"), + DEPT_USER_EXIST("4022", "部门下存在用户"), + NOT_CONFIG_PAGE_BUTTON_TYPE("4023", "未配置按钮雷星"), + MODEL_PAGE_RELATION_MODEL("4024", "已关联当前模型页面"), + MODEL_PAGE_NOT_EXIST("4025", "模型页面不存在或已被删除"), + MODEL_HAS_RELATION_MODEL_PAGE("4026", "当前模型已关联模型页面,不允许删除"), + FORM_NOT_EXIST("4027", "模型表单不存在"), + READ_FILE_ERROR("4028", "读取模型页面的模板文件失败"), + MODEL_PAGE_CONTENT_NULL("4029", "未配置模型页面的模板文件"), + NOT_CONFIG_QUERY_SQL("4030", "未配置查询语句"), + APP_PAGE_BUTTON_OPTION_VALUE_ERROR("4031", "未配置接口"), + DELETE_COLUMN_ERROR("4032", "删除当前失败"), + INSERT_DATA_ERROR("4033", "新建数据失败"), + EDIT_DATA_ERROR("4034", "编辑数据失败"), + DATASOURCE_HAS_MODELS("4035", "当前数据源存在模型,不允许删除"), + NOT_CONFIG_FORM_API("4036", "未配置模型表单页的接口信息"), + PLEASE_WRITE_AT_LEAST_DATA("4037", "请至少填写一行数据"), + AMIS_PAGE_ERROR("4038", "分页参数异常"), + QUERY_APP_PAGE_QUERY_FIELD_ERROR("4039", "查询搜素参数异常"), + REQUEST_PARAM_NOT_IN_APP_PAGE_QUERY_FIELD("4040", "请求参数不在查询数据表中"), + STYLE_LANGUAGE_ON_CSS("4041", "自定义css中的样式语言不能为空"), + APP_CONFIG_TYPE_NOT_EXIST("4042", "不支持当前应用设置的类型"), + APP_CONFIG_NOT_EXIST_OR_DELETED("4043", "当前设置不存在或已被删除"), + APP_HAS_CONFIG_ON_THIS_TYPE("4044", "当前应用设置的类型已存在,请更新"), + NOT_SUPPORT_COMPONENT_FRAME("4045", "不支持当前组件框架"), + NOT_SUPPORT_COMPONENT_TYPE("4046", "不支持当前组件类型"), + CURRENT_APP_KEY_EXIST("4047", "当前应用的组件key已存在"), + CREATE_CUSTOM_COMPONENT_ERROR("4048", "新增自定义组件失败"), + APP_CUSTOM_COMPONENT_NOT_EXIST("4049", "当前组件不存在或已被删除"), + UPDATE_CUSTOM_COMPONENT_ERROR("4050", "更新自定义组件失败"), + DELETED_CUSTOM_COMPONENT_ERROR("4051", "删除自定义组件失败"), + INSERT_COMPONENT_DEPENDENCE_ERROR("4052", "新增自定义组件依赖项失败"), + DELETE_COMPONENT_DEPENDENCE_ERROR("4053", "删除自定义组件依赖项失败"), + CURRENT_COMPONENT_DEPENDENCE_NOT_EXIST("4054", "当前自定义组件依赖项不存在或已被删除"), + CURRENT_APP_NAME_EXIST("4055", "当前应用的组件名称已存在"), + NOT_SUPPORT_DATASOURCE_FROM("4056", "不支持当前的数据库来源"), + JDBC_CONFIG_ERROR("4057", "平台内置的数据源配置有误"), + NOT_SUPPORT_MODEL_TYPE("4058", "不支持当前的页面模板"), + NOT_SUPPORT_CUSTOM_PAGE("4059", "暂不支持自定义页面"), + FORM_PAGE_ON_DEVELOPING("4060", "自定义页面的该功能正在开发中..."), + APP_PAGE_QUERY_FIELD_NOT_EXIST("4061", "当前查询条件不存在,或已被删除"), + APP_PAGE_BUTTON_NOT_EXIST("4062", "当前页面按钮不存在,或已被删除"), + TABLE_KEY_MORE_THEN_ONE("4063", "主键超过一个"), + TABLE_KEY_LESS_THEN_ONE("4064", "主键必须存在"), + TABLE_KEY_MUST_BE_INT("4065", "主键必须为整数类型"), + TABLE_FIELD_MUST_EXIST("4066", "必须存在表字段"), + CURRENT_MODEL_PAGE_HAS_CONVERSION_CUSTOM_PAGE("4067", "当前模型页面已转成自定义页面"), + NOT_SUPPORT_RELEASE_STATUS("4068", "发布版本状态有误"), + APP_FORM_BUTTON_NOT_EXIST("4067", "当前表单按钮不存在,或已被删除"), + DATASOURCE_KEY_EXIST_ERROR("4068","数据源key已存在") + ; + + CodeMessageEnum(String code, String message) { + this.code = code; + this.message = message; + } + + /** 返回到前端的code值 */ + private String code; + + /** 返回到前端的code对应的message值 */ + private String message; + + @Override + public String getCode() { + return this.code; + } + + @Override + public String getMessage() { + return this.message; + } + +// public static CodeVo getJsonObjectByCode(String code) { +// CodeVo codeVo = new CodeVo(); +// if (Tools.isEmpty(code)) { +// return codeVo; +// } +// for (CodeMessageEnum enumObj : CodeMessageEnum.values()) { +// if (enumObj.getCode().equals(code)) { +// return new CodeVo(code, enumObj.message); +// } +// } +// return codeVo; +// } +} diff --git a/review_repo/src/main/java/com/zcloud/util/HttpClientUtil.java b/review_repo/src/main/java/com/zcloud/util/HttpClientUtil.java new file mode 100644 index 0000000..69b6ca9 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/HttpClientUtil.java @@ -0,0 +1,389 @@ +package com.zcloud.util; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.sun.net.ssl.HttpsURLConnection; +import com.sun.net.ssl.KeyManagerFactory; +import com.sun.net.ssl.SSLContext; +import com.sun.net.ssl.TrustManagerFactory; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.*; +import java.security.cert.CertificateException; +import java.util.*; + +public class HttpClientUtil { + /** + * http客户端工具类 + * + */ + public static final String SunX509 = "SunX509"; + public static final String JKS = "JKS"; + public static final String PKCS12 = "PKCS12"; + public static final String TLS = "TLS"; + private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientUtil.class); + public static Map doPost(String url, Map map) { + JSONObject jsonObject = null; + HttpResponse response = null; + List nameValuePairList = new ArrayList(); + System.out.print("参数:{"); + for(Map.Entry entry : map.entrySet()){ + System.out.print(entry.getKey().toString() + ":" + entry.getValue().toString() + ","); + nameValuePairList.add(new BasicNameValuePair(entry.getKey().toString(), entry.getValue().toString())); + } + System.out.println("}"); + try{ + /** + * 创建一个httpclient对象 + */ + HttpClient client = HttpClients.createDefault(); + /** + * 创建一个post对象 + */ + HttpPost post = new HttpPost(url); + /** + * 设置请求的报文头部的编码 + */ + post.setHeader(new BasicHeader("Source", "zcloud")); + post.setHeader(new BasicHeader("thirdSecret", "aIM1gfGGItQX7EaoGEr2la8FZg29SNqv52GXM4YGUSFLMW9Xsg0PrhZ8WMEY5vdkavNIU3Q0")); + post.setHeader(new BasicHeader("thirdKey", "maZ4sKs5UvetCwQT1396vYrzy7JmSN2UlOh21Pe4Mrdh2RmCzSnKnY4xAfq8p7aXdvVjxtrrfb")); + /** + * 设置请求的报文头部的编码 + */ + post.setHeader(new BasicHeader("Content-Type", "application/x-www-form-urlencoded;")); + /** + * 包装成一个Entity对象 + */ + StringEntity entity = new UrlEncodedFormEntity(nameValuePairList, "UTF-8"); + /** + * 设置请求的内容 + */ + post.setEntity(entity); + /** + * 执行post请求 + */ + response = client.execute(post); + /** + * 获取响应码 + */ + int statusCode = response.getStatusLine().getStatusCode(); +// System.out.println("statusCode:" + statusCode); + if (200 == statusCode){ + /** + * 通过EntityUitls获取返回内容 + */ + String result = EntityUtils.toString(response.getEntity(),"UTF-8"); +// System.out.println(result); + /** + * 转换成json,根据合法性返回json或者字符串 + */ + try{ + jsonObject = JSONObject.parseObject(result); + Map maps = new HashMap(); + maps = parseJSON2Map(jsonObject); + return maps; + }catch (Exception e){ + e.printStackTrace(); + return null; + } + }else{ + LOGGER.error("HttpClientUtil-line: {}, errorMsg:{}", 146, "POST请求失败!"); + } + } catch (Exception e){ + LOGGER.error("HttpClientUtil-line: {}, Exception:{}", 149, e); + } finally { + /* response.close(); + client.close();*/ + } + return null; + + } + + public static Map parseJSON2Map(JSONObject json) { + Map map = new HashMap(); + // 最外层解析 + for (Object k : json.keySet()) { + Object v = json.get(k); + // 如果内层还是json数组的话,继续解析 + if (v instanceof JSONArray) { + List> list = new ArrayList>(); + Iterator it = ((JSONArray) v).iterator(); + while (it.hasNext()) { + JSONObject json2 = (JSONObject) it.next(); + list.add(parseJSON2Map(json2)); + } + map.put(k.toString(), list); + } else if (v instanceof JSONObject) { + // 如果内层是json对象的话,继续解析 + map.put(k.toString(), parseJSON2Map((JSONObject) v)); + } else { + // 如果内层是普通对象的话,直接放入map中 + map.put(k.toString(), v); + } + } + return map; + } + + /** + * get HttpURLConnection + * @param strUrl url地址 + * @return HttpURLConnection + * @throws IOException + */ + public static HttpURLConnection getHttpURLConnection(String strUrl) + throws IOException { + URL url = new URL(strUrl); + HttpURLConnection httpURLConnection = (HttpURLConnection) url + .openConnection(); + return httpURLConnection; + } + + /** + * get HttpsURLConnection + * @param strUrl url地址ַ + * @return HttpsURLConnection + * @throws IOException + */ + public static HttpsURLConnection getHttpsURLConnection(String strUrl) + throws IOException { + URL url = new URL(strUrl); + HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url + .openConnection(); + return httpsURLConnection; + } + + /** + * 获取不带查询串的url + * @param strUrl + * @return String + */ + public static String getURL(String strUrl) { + + if(null != strUrl) { + int indexOf = strUrl.indexOf("?"); + if(-1 != indexOf) { + return strUrl.substring(0, indexOf); + } + + return strUrl; + } + + return strUrl; + + } + + /** + * 获取查询串 + * @param strUrl + * @return String + */ + public static String getQueryString(String strUrl) { + + if(null != strUrl) { + int indexOf = strUrl.indexOf("?"); + if(-1 != indexOf) { + return strUrl.substring(indexOf+1, strUrl.length()); + } + + return ""; + } + + return strUrl; + } + + /** + * 查询字符串转化为map + * name1=key1&name2=key2&... + * @param queryString + * @return + */ + public static Map queryString2Map(String queryString) { + if(null == queryString || "".equals(queryString)) { + return null; + } + + Map m = new HashMap(); + String[] strArray = queryString.split("&"); + for(int index = 0; index < strArray.length; index++) { + String pair = strArray[index]; + HttpClientUtil.putMapByPair(pair, m); + } + + return m; + + } + + /** + * 把键值添加到map + * pair:name=value + * @param pair name=value + * @param m + */ + public static void putMapByPair(String pair, Map m) { + + if(null == pair || "".equals(pair)) { + return; + } + + int indexOf = pair.indexOf("="); + if(-1 != indexOf) { + String k = pair.substring(0, indexOf); + String v = pair.substring(indexOf+1, pair.length()); + if(null != k && !"".equals(k)) { + m.put(k, v); + } + } else { + m.put(pair, ""); + } + } + /** + * BufferedReader转换成String
    + * 注意:流关闭需要自行处理 + * @param reader + * @return + * @throws IOException + */ + public static String bufferedReader2String(BufferedReader reader) throws IOException { + StringBuffer buf = new StringBuffer(); + String line = null; + while( (line = reader.readLine()) != null) { + buf.append(line); + buf.append("\r\n"); + } + + return buf.toString(); + } + /** + * 处理输出
    + * 注意:流关闭需要自行处理 + * @param out + * @param data + * @param len + * @throws IOException + */ + public static void doOutput(OutputStream out, byte[] data, int len) + throws IOException { + int dataLen = data.length; + int off = 0; + while (off < data.length) { + if (len >= dataLen) { + out.write(data, off, dataLen); + off += dataLen; + } else { + out.write(data, off, len); + off += len; + dataLen -= len; + } + + // ˢ�»����� + out.flush(); + } + + } + /** + * 获取SSLContext + * @param trustPasswd + * @param keyPasswd + * @return + * @throws NoSuchAlgorithmException + * @throws KeyStoreException + * @throws IOException + * @throws CertificateException + * @throws UnrecoverableKeyException + * @throws KeyManagementException + */ + public static SSLContext getSSLContext( + FileInputStream trustFileInputStream, String trustPasswd, + FileInputStream keyFileInputStream, String keyPasswd) + throws NoSuchAlgorithmException, KeyStoreException, + CertificateException, IOException, UnrecoverableKeyException, + KeyManagementException { + + // ca + TrustManagerFactory tmf = TrustManagerFactory.getInstance(HttpClientUtil.SunX509); + KeyStore trustKeyStore = KeyStore.getInstance(HttpClientUtil.JKS); + trustKeyStore.load(trustFileInputStream, HttpClientUtil + .str2CharArray(trustPasswd)); + tmf.init(trustKeyStore); + + final char[] kp = HttpClientUtil.str2CharArray(keyPasswd); + KeyManagerFactory kmf = KeyManagerFactory.getInstance(HttpClientUtil.SunX509); + KeyStore ks = KeyStore.getInstance(HttpClientUtil.PKCS12); + ks.load(keyFileInputStream, kp); + kmf.init(ks, kp); + + SecureRandom rand = new SecureRandom(); + SSLContext ctx = SSLContext.getInstance(HttpClientUtil.TLS); + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), rand); + + return ctx; + } + + /** + * 字符串转换成char数组 + * @param str + * @return char[] + */ + public static char[] str2CharArray(String str) { + if(null == str) return null; + + return str.toCharArray(); + } + + public static InputStream String2Inputstream(String str) { + return new ByteArrayInputStream(str.getBytes()); + } + + /** + * InputStream转换成Byte + * 注意:流关闭需要自行处理 + * @param in + * @return byte + * @throws Exception + */ + public static byte[] InputStreamTOByte(InputStream in) throws IOException{ + + int BUFFER_SIZE = 4096; + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + byte[] data = new byte[BUFFER_SIZE]; + int count = -1; + + while((count = in.read(data,0,BUFFER_SIZE)) != -1) + outStream.write(data, 0, count); + + data = null; + byte[] outByte = outStream.toByteArray(); + outStream.close(); + + return outByte; + } + + /** + * InputStream转换成String + * 注意:流关闭需要自行处理 + * @param in + * @param encoding 编码 + * @return String + * @throws Exception + */ + public static String InputStreamTOString(InputStream in,String encoding) throws IOException{ + + return new String(InputStreamTOByte(in),encoding); + + } + +} diff --git a/review_repo/src/main/java/com/zcloud/util/HttpRequestUtil.java b/review_repo/src/main/java/com/zcloud/util/HttpRequestUtil.java new file mode 100644 index 0000000..2b9058c --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/HttpRequestUtil.java @@ -0,0 +1,371 @@ +package com.zcloud.util; + +import com.alibaba.fastjson.JSONObject; +import org.springframework.lang.Nullable; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; + +/** + * description: http请求工具类 + * + * @date 2022-07-01 + */ +public class HttpRequestUtil { + + public static String sendRequest(String urlParam) throws Exception { + InputStream inputStream = null; + BufferedReader buffer = null; + try { + URL url = new URL(urlParam); + URLConnection con = url.openConnection(); + //设置请求需要返回的数据类型和字符集类型 + con.setRequestProperty("Content-Type", "application/json;charset=GBK"); + //允许写出 + con.setDoOutput(true); + //允许读入 + con.setDoInput(true); + //不使用缓存 + con.setUseCaches(false); + //得到响应流 + inputStream = con.getInputStream(); + //将响应流转换成字符串 + StringBuffer resultBuffer = new StringBuffer(); + String line; + buffer = new BufferedReader(new InputStreamReader(inputStream, "GBK")); + while ((line = buffer.readLine()) != null) { + resultBuffer.append(line); + } + return resultBuffer.toString(); + } catch (Exception e) { + buffer.close(); + inputStream.close(); + e.printStackTrace(); + } + + return ""; + } + + public static String getRestInformation(HttpServletRequest request) throws Exception { + return getRestInformation(request, String.class); + } + + public static T getRestInformation(HttpServletRequest request, Class clazz) throws Exception { + BufferedReader reader = null; + try { + + StringBuffer data = new StringBuffer(); + String line = null; + reader = request.getReader(); + while (null != (line = reader.readLine())) data.append(line); + reader.close(); + T result = JSONObject.parseObject(data.toString(), clazz); + return result; + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("解析请求报文出错"); + } finally { + reader.close(); + } + } + + /** + * Http get请求 + * + * @param httpUrl 连接 + * @return 响应数据 + */ + public static String doGet(String httpUrl) throws Exception { + //链接 + HttpURLConnection connection = null; + InputStream is = null; + BufferedReader br = null; + StringBuffer result = new StringBuffer(); + try { + //创建连接 + URL url = new URL(httpUrl); + connection = (HttpURLConnection) url.openConnection(); + //设置请求方式 + connection.setRequestMethod("GET"); + //设置连接超时时间 + connection.setReadTimeout(15000); + //开始连接 + connection.connect(); + //获取响应数据 + if (connection.getResponseCode() == 200) { + //获取返回的数据 + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭远程连接 + connection.disconnect(); + } + return result.toString(); + } + + /** + * Http get请求 + * + * @param httpUrl 连接 + * @return 响应数据 + */ + public static String doGetUser(String httpUrl, String token) throws Exception { + //链接 + HttpURLConnection connection = null; + InputStream is = null; + BufferedReader br = null; + StringBuffer result = new StringBuffer(); + try { + //创建连接 + URL url = new URL(httpUrl); + connection = (HttpURLConnection) url.openConnection(); + //设置请求方式 + connection.setRequestMethod("GET"); + //设置连接超时时间 + connection.setReadTimeout(15000); + //设置token + connection.setRequestProperty("Authorization", token); + //开始连接 + connection.connect(); + //获取响应数据 + if (connection.getResponseCode() == 200) { + //获取返回的数据 + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭远程连接 + connection.disconnect(); + } + return result.toString(); + } + + /** + * Http post请求 + * + * @param httpUrl 连接 + * @param param 参数 + * @return + */ + public static String doPost(String httpUrl, @Nullable String param) { + StringBuffer result = new StringBuffer(); + //连接 + HttpURLConnection connection = null; + OutputStream os = null; + InputStream is = null; + BufferedReader br = null; + try { + //创建连接对象 + URL url = new URL(httpUrl); + //创建连接 + connection = (HttpURLConnection) url.openConnection(); + //设置请求方法 + connection.setRequestMethod("POST"); + //设置连接超时时间 + connection.setConnectTimeout(15000); + //设置读取超时时间 + connection.setReadTimeout(15000); + //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个 + //设置是否可读取 + connection.setDoOutput(true); + connection.setDoInput(true); + //设置通用的请求属性 +// connection.setRequestProperty("accept", "*/*"); +// connection.setRequestProperty("connection", "Keep-Alive"); +// connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); + System.out.println(param); + //拼装参数 + if (null != param && !param.equals("")) { + //设置参数 + os = connection.getOutputStream(); + //拼装参数 + os.write(param.getBytes()); + } + //设置权限 + //设置请求头等 + //开启连接 + //connection.connect(); + //读取响应 + if (connection.getResponseCode() == 200) { + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + result.append("\r\n"); + } + } + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + //关闭连接 + if (br != null) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (os != null) { + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭连接 + connection.disconnect(); + } + return result.toString(); + } + + public static String doPost(String token, String httpUrl, @Nullable String param) { + StringBuffer result = new StringBuffer(); + //连接 + HttpURLConnection connection = null; + OutputStream os = null; + InputStream is = null; + BufferedReader br = null; + try { + //创建连接对象 + URL url = new URL(httpUrl); + //创建连接 + connection = (HttpURLConnection) url.openConnection(); + //设置请求方法 + connection.setRequestMethod("POST"); + //设置连接超时时间 + connection.setConnectTimeout(15000); + //设置读取超时时间 + connection.setReadTimeout(15000); + //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个 + //设置是否可读取 + connection.setDoOutput(true); + connection.setDoInput(true); + //设置通用的请求属性 +// connection.setRequestProperty("accept", "*/*"); +// connection.setRequestProperty("connection", "Keep-Alive"); +// connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); + connection.setRequestProperty("Authorization", token); + System.out.println(param); + //拼装参数 + if (null != param && !param.equals("")) { + //设置参数 + os = connection.getOutputStream(); + //拼装参数 + os.write(param.getBytes()); + } + //设置权限 + //设置请求头等 + //开启连接 + //connection.connect(); + //读取响应 + if (connection.getResponseCode() == 200) { + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + result.append("\r\n"); + } + } + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + //关闭连接 + if (br != null) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (os != null) { + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭连接 + connection.disconnect(); + } + return result.toString(); + } + + +} diff --git a/review_repo/src/main/java/com/zcloud/util/HttpRequestUtilCheck.java b/review_repo/src/main/java/com/zcloud/util/HttpRequestUtilCheck.java new file mode 100644 index 0000000..05c7698 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/HttpRequestUtilCheck.java @@ -0,0 +1,361 @@ +package com.zcloud.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.zcloud.common.utils.Tools; +import org.springframework.lang.Nullable; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.HashMap; + +/** + * description: http请求工具类 + * + * @date 2022-07-01 + */ +public class HttpRequestUtilCheck { + + public static String sendRequest(String urlParam) throws Exception { + InputStream inputStream = null; + BufferedReader buffer = null; + try { + URL url = new URL(urlParam); + URLConnection con = url.openConnection(); + //设置请求需要返回的数据类型和字符集类型 + con.setRequestProperty("Content-Type", "application/json;charset=GBK"); + //允许写出 + con.setDoOutput(true); + //允许读入 + con.setDoInput(true); + //不使用缓存 + con.setUseCaches(false); + //得到响应流 + inputStream = con.getInputStream(); + //将响应流转换成字符串 + StringBuffer resultBuffer = new StringBuffer(); + String line; + buffer = new BufferedReader(new InputStreamReader(inputStream, "GBK")); + while ((line = buffer.readLine()) != null) { + resultBuffer.append(line); + } + return resultBuffer.toString(); + } catch (Exception e) { + buffer.close(); + inputStream.close(); + e.printStackTrace(); + } + + return ""; + } + + public static String getRestInformation(HttpServletRequest request) throws Exception { + return getRestInformation(request, String.class); + } + + public static T getRestInformation(HttpServletRequest request, Class clazz) throws Exception { + BufferedReader reader = null; + try { + + StringBuffer data = new StringBuffer(); + String line = null; + reader = request.getReader(); + while (null != (line = reader.readLine())) data.append(line); + reader.close(); + T result = JSONObject.parseObject(data.toString(), clazz); + return result; + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("解析请求报文出错"); + } finally { + reader.close(); + } + } + + /** + * Http get请求 + * + * @param httpUrl 连接 + * @return 响应数据 + */ + public static String doGet(String httpUrl) throws Exception { + //链接 + HttpURLConnection connection = null; + InputStream is = null; + BufferedReader br = null; + StringBuffer result = new StringBuffer(); + try { + //创建连接 + URL url = new URL(httpUrl); + connection = (HttpURLConnection) url.openConnection(); + //设置请求方式 + connection.setRequestMethod("GET"); + //设置连接超时时间 + connection.setReadTimeout(15000); + //开始连接 + connection.connect(); + //获取响应数据 + if (connection.getResponseCode() == 200) { + //获取返回的数据 + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭远程连接 + connection.disconnect(); + } + return result.toString(); + } + + /** + * Http get请求 + * + * @param httpUrl 连接 + * @return 响应数据 + */ + public static String doGetUser(String httpUrl, String token) throws Exception { + //链接 + HttpURLConnection connection = null; + InputStream is = null; + BufferedReader br = null; + StringBuffer result = new StringBuffer(); + try { + //创建连接 + URL url = new URL(httpUrl); + connection = (HttpURLConnection) url.openConnection(); + //设置请求方式 + connection.setRequestMethod("GET"); + //设置连接超时时间 + connection.setReadTimeout(15000); + //设置token + connection.setRequestProperty("Authorization", token); + //开始连接 + connection.connect(); + //获取响应数据 + if (connection.getResponseCode() == 200) { + //获取返回的数据 + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭远程连接 + connection.disconnect(); + } + return result.toString(); + } + + + public static String doPost(String token, String httpUrl, @Nullable String param) { + StringBuffer result = new StringBuffer(); + //连接 + HttpURLConnection connection = null; + OutputStream os = null; + InputStream is = null; + BufferedReader br = null; + try { + //创建连接对象 + URL url = new URL(httpUrl); + //创建连接 + connection = (HttpURLConnection) url.openConnection(); + //设置请求方法 + connection.setRequestMethod("POST"); + //设置连接超时时间 + connection.setConnectTimeout(15000); + //设置读取超时时间 + connection.setReadTimeout(15000); + //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个 + //设置是否可读取 + connection.setDoOutput(true); + connection.setDoInput(true); + //设置通用的请求属性 +// connection.setRequestProperty("accept", "*/*"); +// connection.setRequestProperty("connection", "Keep-Alive"); +// connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); + connection.setRequestProperty("Authorization", token); + System.out.println(param); + //拼装参数 + if (null != param && !param.equals("")) { + //设置参数 + os = connection.getOutputStream(); + //拼装参数 + os.write(param.getBytes()); + } + //设置权限 + //设置请求头等 + //开启连接 + //connection.connect(); + //读取响应 + if (connection.getResponseCode() == 200) { + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + result.append("\r\n"); + } + } + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + //关闭连接 + if (br != null) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (os != null) { + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭连接 + connection.disconnect(); + } + return result.toString(); + } + + + public static ReturnMap doPost(String httpUrl) { + StringBuffer result = new StringBuffer(); + //连接 + HttpURLConnection connection = null; + OutputStream os = null; + InputStream is = null; + BufferedReader br = null; + try { + //创建连接对象 + URL url = new URL(httpUrl); + //创建连接 + connection = (HttpURLConnection) url.openConnection(); + //设置请求方法 + connection.setRequestMethod("POST"); + //设置连接超时时间 + connection.setConnectTimeout(15000); + //设置读取超时时间 + connection.setReadTimeout(15000); + //DoOutput设置是否向httpUrlConnection输出,DoInput设置是否从httpUrlConnection读入,此外发送post请求必须设置这两个 + //设置是否可读取 + connection.setDoOutput(true); + connection.setDoInput(true); + //设置通用的请求属性 + connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); + //设置权限 + //设置请求头等 + //开启连接 + //connection.connect(); + //读取响应 + if (connection.getResponseCode() == 200) { + is = connection.getInputStream(); + if (null != is) { + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String temp = null; + while (null != (temp = br.readLine())) { + result.append(temp); + result.append("\r\n"); + } + } + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + //关闭连接 + if (br != null) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (os != null) { + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //关闭连接 + connection.disconnect(); + } + ReturnMap returnMap = new ReturnMap(); + if (Tools.notEmpty(result.toString())) { + HashMap o = JSON.parseObject(result.toString(), HashMap.class); + returnMap.putAll(o); + } + return returnMap; + } +} diff --git a/review_repo/src/main/java/com/zcloud/util/HttpsFileDownload.java b/review_repo/src/main/java/com/zcloud/util/HttpsFileDownload.java new file mode 100644 index 0000000..6999958 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/HttpsFileDownload.java @@ -0,0 +1,113 @@ +package com.zcloud.util; + + + +import javax.net.ssl.*; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; + +public class HttpsFileDownload { + public static InputStream getNetUrlHttpsStream(String fileUrl,String imagePrefix) { + try { + + SSLContext sslcontext = SSLContext.getInstance("SSL", "SunJSSE"); + sslcontext.init(null, new TrustManager[]{new X509TrustUtiil()}, new java.security.SecureRandom()); + URL url = new URL(imagePrefix+fileUrl); + HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String s, SSLSession sslsession) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); + HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); + if(imagePrefix.contains("https")){ + HttpsURLConnection urlCon = (HttpsURLConnection) url.openConnection(); + urlCon.setConnectTimeout(600000); + urlCon.setReadTimeout(600000); + int code = urlCon.getResponseCode(); + if (code != HttpURLConnection.HTTP_OK) { + System.out.println("文件读取失败(获取的图片不存在)"); + System.out.println(imagePrefix+fileUrl); + return null; + } + return urlCon.getInputStream(); + }else { + HttpURLConnection urlCon = (HttpURLConnection) url.openConnection(); + urlCon.setConnectTimeout(600000); + urlCon.setReadTimeout(600000); + int code = urlCon.getResponseCode(); + if (code != HttpURLConnection.HTTP_OK) { + System.out.println("文件读取失败(获取的图片不存在)"); + System.out.println(imagePrefix+fileUrl); + return null; + } + return urlCon.getInputStream(); + } + } catch (Exception e) { + e.printStackTrace(); + throw new BizException("文件读取失败"); + } + } + /** + * 下载文件到本地(支持https) + * + * @param fileUrl 远程地址 + * @throws Exception + */ + public static File getNetUrlHttps(String fileUrl,String file_name) { + File file = null; + + DataInputStream in = null; + DataOutputStream out = null; + try { + file = File.createTempFile("net_url", file_name); + + SSLContext sslcontext = SSLContext.getInstance("SSL", "SunJSSE"); + sslcontext.init(null, new TrustManager[]{new X509TrustUtiil()}, new java.security.SecureRandom()); + URL url = new URL(fileUrl); + HostnameVerifier ignoreHostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String s, SSLSession sslsession) { + return true; + } + }; + HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostnameVerifier); + HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory()); + HttpsURLConnection urlCon = (HttpsURLConnection) url.openConnection(); + urlCon.setConnectTimeout(6000); + urlCon.setReadTimeout(6000); + int code = urlCon.getResponseCode(); + if (code != HttpURLConnection.HTTP_OK) { + System.out.println("文件读取失败(获取的图片不存在)"); + return null; + } + // 读文件流 + in = new DataInputStream(urlCon.getInputStream()); + out = new DataOutputStream(new FileOutputStream(file)); + byte[] buffer = new byte[2048]; + int count = 0; + while ((count = in.read(buffer)) > 0) { + out.write(buffer, 0, count); + } + out.close(); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (null != out) { + out.close(); + } + if (null != in) { + in.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + return file; + } +} diff --git a/review_repo/src/main/java/com/zcloud/util/PerLocUtil.java b/review_repo/src/main/java/com/zcloud/util/PerLocUtil.java new file mode 100644 index 0000000..6a001db --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/PerLocUtil.java @@ -0,0 +1,64 @@ +package com.zcloud.util; + +import com.alibaba.fastjson.JSONObject; +import com.zcloud.common.utils.HttpRequestUtil; +import com.zcloud.modules.personLocationToken.mapper.PersonLocationTokenMapper; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 人员定位系统工具类 + * @author zhangyue + * @date 2023/9/20/020 17:33 + */ +@Component +public class PerLocUtil { + + @Value("${perLoc.url}") + private String url; + @Value("${perLoc.userName}") + private String userName; + @Value("${perLoc.pwd}") + private String pwd; + @Resource + private PersonLocationTokenMapper personLocationTokenMapper; + + public String getToken() throws Exception{ + String token = personLocationTokenMapper.getToken(); + // token 不为空。验证token是否失效 + if (StringUtils.isNotEmpty(token)){ + String httpResponseStr = HttpRequestUtil.doGet(this.url + "/system/token/verifyThatTheTokenIsInvalid"+"?token="+token); + JSONObject httpResponse = JSONObject.parseObject(httpResponseStr); + // token 有效 + if(StringUtils.isNotEmpty(httpResponseStr) && httpResponse != null + && httpResponse.get("code") != null && httpResponse.getInteger("code") == 200){ + return token; + } else { // token 失效 或者报错 + token = goToLogin(); + } + } else { + token = goToLogin(); + } + return token; + } + + private String goToLogin() throws Exception{ + JSONObject request = new JSONObject(); + request.put("username", userName); + request.put("password", pwd); + String loginResStr = HttpRequestUtil.doPost(this.url + "/auth/login", request.toJSONString()); + JSONObject loginResponse = JSONObject.parseObject(loginResStr); + // 登录成功 + if(StringUtils.isNotEmpty(loginResStr) && loginResponse != null + && loginResponse.get("code") != null && loginResponse.getInteger("code") == 200 + && loginResponse.get("data") != null && loginResponse.getJSONObject("data").getString("access_token") != null){ + personLocationTokenMapper.edit(loginResponse.getJSONObject("data").getString("access_token")); + return loginResponse.getJSONObject("data").getString("access_token"); + } else { // 登录失败 + throw new RuntimeException("第三方登录失败"); + } + } +} diff --git a/review_repo/src/main/java/com/zcloud/util/ReturnMap.java b/review_repo/src/main/java/com/zcloud/util/ReturnMap.java new file mode 100644 index 0000000..07fc0ec --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/ReturnMap.java @@ -0,0 +1,146 @@ +package com.zcloud.util; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ + +import org.apache.http.HttpStatus; + +import java.util.HashMap; +import java.util.Map; + +/** + * @description: R类 + **/ +public class ReturnMap extends HashMap { + /** + * 序列ID + */ + private static final long serialVersionUID = 1L; + + /** + * R的无参构造, 初始化信息 + */ + public ReturnMap() { + put("code", 0); + put("msg", "success"); + put("result", "success"); + } + + /** + * error1: 返回默认error + * + * @return 返回默认error + */ + public static ReturnMap error() { + return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常, 请联系管理员"); + } + + /** + * error2 + * + * @param msg 错误信息 + * @return 返回自定义信息的error + */ + public static ReturnMap error(String msg) { + return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg); + } + public static ReturnMap error(CodeMessageEnum codeMessageEnum) { + return error(codeMessageEnum.getCode(), codeMessageEnum.getMessage()); + } + public static ReturnMap error(CodeMessageEnum codeMessageEnum, String uri) { + return error(codeMessageEnum.getCode(), codeMessageEnum.getMessage(), uri); + } + /** + * 原先R的code和msg被覆盖 + * + * @param code 错误码 + * @param msg 错误信息 + * @return 自定义的错误码和错误信息 + */ + public static ReturnMap error(int code, String msg) { + ReturnMap r = new ReturnMap(); + r.put("code", code); + r.put("result", "error"); + r.put("msg", msg); + return r; + } + + public static ReturnMap error(String code, String msg) { + ReturnMap r = new ReturnMap(); + r.put("code", code); + r.put("result", "error"); + r.put("msg", msg); + return r; + } + + public static ReturnMap error(String code, String msg, String uri) { + ReturnMap r = new ReturnMap(); + r.put("code", code); + r.put("result", "error"); + r.put("msg", msg); + r.put("uri", uri); + return r; + } + + /** + * ok1 + * 加入了msg + * + * @param msg + * @return + */ + public static ReturnMap ok(String msg) { + ReturnMap r = new ReturnMap(); + r.put("msg", msg); + return r; + } + + /** + * ok2: 加入了map + * + * @param map + * @return + */ + public static ReturnMap ok(Map map) { + ReturnMap r = new ReturnMap(); + r.putAll(map); + return r; + } + + /** + * ok3: 直接返回"0", "success" + * + * @return + */ + public static ReturnMap ok() { + return new ReturnMap(); + } + + /** + * 放入自定义的key和value, 然后返回 + * + * @param key + * @param value + * @return + */ + @Override + public ReturnMap put(String key, Object value) { + super.put(key, value); + return this; + } + + /** + * 得到这个对象的code + * + * @return + */ + public Integer getCode() { + return (Integer) this.get("code"); + } +} + + + diff --git a/review_repo/src/main/java/com/zcloud/util/Smb.java b/review_repo/src/main/java/com/zcloud/util/Smb.java new file mode 100644 index 0000000..cfa410d --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/Smb.java @@ -0,0 +1,196 @@ +package com.zcloud.util; + +import com.jcraft.jsch.*; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Vector; + +@Component +public class Smb { + + public static String host; + public static Integer port; + public static String user; + public static String password; + public static String basePath; + + @Value("${smb.host}") + public void setHostPath(String hostProperties) { + host = hostProperties; + } + + @Value("${smb.port}") + public void setPortPath(Integer portProperties) { + port = portProperties; + } + + @Value("${smb.user}") + public void setUserPath(String userProperties) { + user = userProperties; + } + + @Value("${smb.password}") + public void setPasswordPath(String passwordProperties) { + password = passwordProperties; + } + + @Value("${smb.basePath}") + public void setBasePath(String basePathProperties) { + basePath = basePathProperties; + } + + + public static void sshSftpForInput(InputStream fileI, String fileName, String path) throws Exception { + Session session = null; + Channel channel = null; + JSch jsch = new JSch(); + if (port <= 0) { + // 连接服务器,采用默认端口 + session = jsch.getSession(user, host); + } else { + // 采用指定的端口连接服务器 + session = jsch.getSession(user, host, port); + } + + // 如果服务器连接不上,则抛出异常 + if (session == null) { + throw new Exception("session is null"); + } + // 设置登陆主机的密码 + session.setPassword(password); + // 设置第一次登陆的时候提示,可选值:(ask | yes | no) + session.setConfig("StrictHostKeyChecking", "no"); + // 设置登陆超时时间 + session.connect(30000); + OutputStream outstream = null; + + try { + // 创建sftp通信通道 + channel = (Channel) session.openChannel("sftp"); + channel.connect(10000); + ChannelSftp sftp = (ChannelSftp) channel; + // 进入服务器指定的文件夹 +// File dir = new File(basePath+"/"+path); +// dir.setWritable(true, false); +// if(!dir.exists()){ +// dir.mkdirs(); +// } + createDir(basePath+path, sftp); + sftp.cd(basePath+path); + // 列出服务器指定的文件列表 +// Vector v = sftp.ls("*"); +// for(int i=0;i vector = channelSftp.ls(basePath + directoryFile); + if (vector.size() == 1) { // 文件,直接删除 + channelSftp.rm(basePath + directoryFile); + System.out.println("4、" + directoryFile + " 删除的文件....."); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + // 切断远程连接 + channelSftp.exit(); + + } +} diff --git a/review_repo/src/main/java/com/zcloud/util/ThreadPoolUtils.java b/review_repo/src/main/java/com/zcloud/util/ThreadPoolUtils.java new file mode 100644 index 0000000..f5a4166 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/ThreadPoolUtils.java @@ -0,0 +1,93 @@ +package com.zcloud.util; + +import java.util.concurrent.*; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ + +public class ThreadPoolUtils { + static int corePoolSize = Runtime.getRuntime().availableProcessors(); + static int maxPoolSize = corePoolSize * 2; + static ExecutorService threadPool = createFixedThreadPool(corePoolSize, maxPoolSize, 1000); + + + public static ExecutorService getThreadPoolService() { + if (threadPool != null) { + return threadPool; + } else { + threadPool = createFixedThreadPool(corePoolSize, maxPoolSize, 1000); + } + return threadPool; + } + + public static ExecutorService createFixedThreadPool(int corePoolSize, int maxPoolSize, + int queueCapacity, ThreadFactory threadFactory, + RejectedExecutionHandler rejectionPolicy) { + return new ThreadPoolExecutor(corePoolSize, maxPoolSize, + 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(queueCapacity), + threadFactory, + rejectionPolicy); + } + + /** + * 创建固定大小的线程池,默认使用 AbortPolicy 拒绝策略 + * + * @param corePoolSize 核心线程数 + * @param maxPoolSize 最大线程数 + * @param queueCapacity 队列容量 + * @return 固定大小的线程池 + */ + public static ExecutorService createFixedThreadPool(int corePoolSize, int maxPoolSize, int queueCapacity) { + return createFixedThreadPool(corePoolSize, maxPoolSize, queueCapacity, + Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy()); + } + + /** + * 创建单线程的线程池 + * + * @param threadFactory 线程工厂 + * @return 单线程的线程池 + */ + public static ExecutorService createSingleThreadExecutor(ThreadFactory threadFactory) { + return Executors.newSingleThreadExecutor(threadFactory); + } + + /** + * 创建单线程的线程池,默认使用 AbortPolicy 拒绝策略 + * + * @return 单线程的线程池 + */ + public static ExecutorService createSingleThreadExecutor() { + return createSingleThreadExecutor(Executors.defaultThreadFactory()); + } + + /** + * 创建缓存型线程池 + * + * @param threadFactory 线程工厂 + * @param rejectionPolicy 拒绝策略 + * @return 缓存型线程池 + */ + public static ExecutorService createCachedThreadPool(ThreadFactory threadFactory, + RejectedExecutionHandler rejectionPolicy) { + return new ThreadPoolExecutor(0, Integer.MAX_VALUE, + 60L, TimeUnit.SECONDS, + new SynchronousQueue<>(), + threadFactory, + rejectionPolicy); + } + + /** + * 创建缓存型线程池,默认使用 AbortPolicy 拒绝策略 + * + * @return 缓存型线程池 + */ + public static ExecutorService createCachedThreadPool() { + return createCachedThreadPool(Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy()); + } +} + diff --git a/review_repo/src/main/java/com/zcloud/util/UuidUtil.java b/review_repo/src/main/java/com/zcloud/util/UuidUtil.java new file mode 100644 index 0000000..86481c5 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/UuidUtil.java @@ -0,0 +1,20 @@ +package com.zcloud.util; + +import java.util.UUID; + +/** + * 说明:生成UUID(32位不重复的字符串) + * 作者:luoxiaobao + * 官网:www.qdkjchina.com + */ +public class UuidUtil { + + public static String get32UUID() { + String uuid = UUID.randomUUID().toString().trim().replaceAll("-", ""); + return uuid; + } + + public static void main(String[] args) { + System.out.println(get32UUID()); + } +} diff --git a/review_repo/src/main/java/com/zcloud/util/X509TrustUtiil.java b/review_repo/src/main/java/com/zcloud/util/X509TrustUtiil.java new file mode 100644 index 0000000..2c02f71 --- /dev/null +++ b/review_repo/src/main/java/com/zcloud/util/X509TrustUtiil.java @@ -0,0 +1,27 @@ +package com.zcloud.util; + +import javax.net.ssl.X509TrustManager; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +public class X509TrustUtiil implements X509TrustManager { + + @Override + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + // TODO Auto-generated method stub + + } + + @Override + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + // TODO Auto-generated method stub + + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/review_repo/src/main/resources/application-dev.yml b/review_repo/src/main/resources/application-dev.yml new file mode 100644 index 0000000..51d6735 --- /dev/null +++ b/review_repo/src/main/resources/application-dev.yml @@ -0,0 +1,61 @@ +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://39.101.130.96:33080/qa-gwj-prevention?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf-8 + username: root + password: Mysql@zcloud33080 + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /druid/* + login-username: admin + login-password: admin + allow: 192.168.0.14 + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + redis: + open: true # 是否开启redis缓存 true开启 false关闭 + database: 0 + host: 192.168.20.230 + port: 16379 + timeout: 6000ms # 连接超时时长(毫秒) + jedis: + pool: + max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 10 # 连接池中的最大空闲连接 + min-idle: 5 # 连接池中的最小空闲连接 +# 人员定位系统对接参数 +perLoc: + url: http://192.168.210.32:8084 + userName: qaaqadmin + pwd: Cfd2023@ + +#smb配置 +smb: + host: 192.168.192.201 + port: 22 + user: root + password: SJSKaqhb@20240131 + basePath: /mnt/vdc1/qask/file/ + diff --git a/review_repo/src/main/resources/application-prod.yml b/review_repo/src/main/resources/application-prod.yml new file mode 100644 index 0000000..3e88a3f --- /dev/null +++ b/review_repo/src/main/resources/application-prod.yml @@ -0,0 +1,50 @@ +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://192.168.0.95:33068/jazz_education?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf-8 +# username: root +# password: Zcloud@88888 + url: jdbc:mysql://127.0.0.1:33688/review_repo?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf-8 + username: root + password: Mysql@zcloud88888 + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /druid/* + #login-username: admin + #login-password: admin + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + redis: + open: true # 是否开启redis缓存 true开启 false关闭 + database: 0 + host: 127.0.0.1 + port: 63799 + password: Zcloud@zcloud88888 # 密码(默认为空) + timeout: 6000ms # 连接超时时长(毫秒) + jedis: + pool: + max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 10 # 连接池中的最大空闲连接 + min-idle: 5 # 连接池中的最小空闲连接 diff --git a/review_repo/src/main/resources/application-test.yml b/review_repo/src/main/resources/application-test.yml new file mode 100644 index 0000000..df33a56 --- /dev/null +++ b/review_repo/src/main/resources/application-test.yml @@ -0,0 +1,34 @@ +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/jazz_education?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + username: root + password: root + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /druid/* + #login-username: admin + #login-password: admin + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true diff --git a/review_repo/src/main/resources/application.yml b/review_repo/src/main/resources/application.yml new file mode 100644 index 0000000..491c9ae --- /dev/null +++ b/review_repo/src/main/resources/application.yml @@ -0,0 +1,62 @@ +# Tomcat +server: + tomcat: + uri-encoding: UTF-8 + threads: + max: 1000 + min-spare: 30 + connection-timeout: 5000ms + port: 8058 + servlet: + context-path: /qa-csy-sync-new + +spring: + main: + allow-circular-references: true + # 环境 dev|test|prod + profiles: + active: dev + # jackson时间格式化 + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + servlet: + multipart: + max-file-size: 100MB + max-request-size: 100MB + enabled: true + mvc: + throw-exception-if-no-handler-found: true + pathmatch: + matching-strategy: ANT_PATH_MATCHER + # APP模块,是通过jwt认证的,如果要使用APP模块,则需要修改【加密秘钥】 + jwt: + # 加密秘钥 + secret: f4e2e52034348f86b67cde581c0f9eb5 + # token有效时长,7天,单位秒 + expire: 604800 + header: token + + +#mybatis +mybatis-plus: + mapper-locations: classpath*:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.zcloud.modules.*.entity,com.zcloud.modules.sys.entity.PageData + executorType: + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ASSIGN_UUID + logic-delete-field: is_delete + logic-delete-value: 1 + logic-not-delete-value: 0 + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + diff --git a/review_repo/src/main/resources/banner.txt b/review_repo/src/main/resources/banner.txt new file mode 100644 index 0000000..2ada298 --- /dev/null +++ b/review_repo/src/main/resources/banner.txt @@ -0,0 +1,15 @@ + ,----, + ,/ .`| ,----.. ,--, ,----.. ____ + ,` .' : / / \ ,--.'| / / \ ,' , `. ,---,. + ; ; / ,--, ,---, / . : ,--, ,--, | : / . : ,-+-,.' _ | ,' .' | +.'___,/ ,' ,'_ /| /_ ./| . / ;. \ ,'_ /| ,---.'| : ' . / ;. \ ,-+-. ; , ||,---.' | +| : | .--. | | :,---, | ' :. ; / ` ; .--. | | : | | : _' |. ; / ` ; ,--.'|' | ;|| | .' +; |.'; ;,'_ /| : . /___/ \. : |; | ; \ ; |,'_ /| : . | : : |.' |; | ; \ ; || | ,', | ':: : |-, +`----' | || ' | | . .. \ \ ,' '| : | ; | '| ' | | . . | ' ' ; :| : | ; | '| | / | | ||: | ;/| + ' : ;| | ' | | | \ ; ` ,'. | ' ' ' :| | ' | | | ' | .'. |. | ' ' ' :' | : | : |,| : .' + | | ': | | : ' ; \ \ ' ' ; \; / |: | | : ' ; | | : | '' ; \; / |; . | ; |--' | | |-, + ' : || ; ' | | ' ' \ | \ \ ', / | ; ' | | ' ' : | : ; \ \ ', / | : | | , ' : ;/| + ; |.' : | : ; ; | \ ; ; ; : / : | : ; ; | | | ' ,/ ; : / | : ' |/ | | \ + '---' ' : `--' \ : \ \ \ \ .' ' : `--' \; : ;--' \ \ .' ; | |`-' | : .' + : , .-./ \ ' ; `---` : , .-./| ,/ `---` | ;/ | | ,' + `--`----' `--` `--`----' '---' '---' `----' diff --git a/review_repo/src/main/resources/logback-spring.xml b/review_repo/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..0ddf694 --- /dev/null +++ b/review_repo/src/main/resources/logback-spring.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/job/ScheduleJobDao.xml b/review_repo/src/main/resources/mapper/job/ScheduleJobDao.xml new file mode 100644 index 0000000..493df6e --- /dev/null +++ b/review_repo/src/main/resources/mapper/job/ScheduleJobDao.xml @@ -0,0 +1,14 @@ + + + + + + + + update schedule_job set status = #{status} where job_id in + + #{jobId} + + + + diff --git a/review_repo/src/main/resources/mapper/job/ScheduleJobLogDao.xml b/review_repo/src/main/resources/mapper/job/ScheduleJobLogDao.xml new file mode 100644 index 0000000..442ad45 --- /dev/null +++ b/review_repo/src/main/resources/mapper/job/ScheduleJobLogDao.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/review_repo/src/main/resources/mapper/map/MapEightMapper.xml b/review_repo/src/main/resources/mapper/map/MapEightMapper.xml new file mode 100644 index 0000000..17a02ef --- /dev/null +++ b/review_repo/src/main/resources/mapper/map/MapEightMapper.xml @@ -0,0 +1,108 @@ + + + + + + + diff --git a/review_repo/src/main/resources/mapper/map/PlatformvideomanagementMapper.xml b/review_repo/src/main/resources/mapper/map/PlatformvideomanagementMapper.xml new file mode 100644 index 0000000..cf27527 --- /dev/null +++ b/review_repo/src/main/resources/mapper/map/PlatformvideomanagementMapper.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/CheckHiddenPushMapper.xml b/review_repo/src/main/resources/mapper/rycheck/CheckHiddenPushMapper.xml new file mode 100644 index 0000000..b75d253 --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/CheckHiddenPushMapper.xml @@ -0,0 +1,41 @@ + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/HiddenCheckUserMapper.xml b/review_repo/src/main/resources/mapper/rycheck/HiddenCheckUserMapper.xml new file mode 100644 index 0000000..9057b77 --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/HiddenCheckUserMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/HiddenMapper.xml b/review_repo/src/main/resources/mapper/rycheck/HiddenMapper.xml new file mode 100644 index 0000000..17e977d --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/HiddenMapper.xml @@ -0,0 +1,42 @@ + + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/HiddenUserMapper.xml b/review_repo/src/main/resources/mapper/rycheck/HiddenUserMapper.xml new file mode 100644 index 0000000..eae13f0 --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/HiddenUserMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/ImgfilesMapper.xml b/review_repo/src/main/resources/mapper/rycheck/ImgfilesMapper.xml new file mode 100644 index 0000000..c48fc78 --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/ImgfilesMapper.xml @@ -0,0 +1,10 @@ + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/RyCheckJhMapper.xml b/review_repo/src/main/resources/mapper/rycheck/RyCheckJhMapper.xml new file mode 100644 index 0000000..4b04f5c --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/RyCheckJhMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/RyCheckJlMapper.xml b/review_repo/src/main/resources/mapper/rycheck/RyCheckJlMapper.xml new file mode 100644 index 0000000..825363c --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/RyCheckJlMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/RyCheckMbMapper.xml b/review_repo/src/main/resources/mapper/rycheck/RyCheckMbMapper.xml new file mode 100644 index 0000000..e43faee --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/RyCheckMbMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/review_repo/src/main/resources/mapper/rycheck/UserMapper.xml b/review_repo/src/main/resources/mapper/rycheck/UserMapper.xml new file mode 100644 index 0000000..ffd3f0d --- /dev/null +++ b/review_repo/src/main/resources/mapper/rycheck/UserMapper.xml @@ -0,0 +1,135 @@ + + + + + insert into oa_department (DEPARTMENT_ID, + NAME, + PARENT_ID, + CORPINFO_ID, + LEVEL, + DEP_ORDER, + ISSUPERVISE) + values (#{DEPARTMENT_ID}, + #{NAME}, + #{PARENT_ID}, + #{CORPINFO_ID}, + #{LEVEL}, + #{DEP_ORDER}, + #{ISSUPERVISE}) + + + USER_ID, + USERNAME, + PASSWORD, + NAME, + ROLE_ID, + LAST_LOGIN, + IP, + STATUS, + BZ, + SKIN, + EMAIL, + NUMBER, + PHONE, + ROLE_IDS, + DEPARTMENT_ID, + POST_ID, + ISMAIN, + + + FUN_IDS, + SORT, + PERSON_TYPE, + IS_HAZARDCONFIRMER, + IS_ONLINELEARNING, + LEARNERCATEGORY, + USERAVATARPREFIX, + USERAVATARURL, + SHIFTDUTYONE, + SHIFTDUTYTWO, + DURATION, + WORKSTATUS, + WORKPERIOD, + JCR, + CORPINFO_ID, + CARDNO, + ISDELETE + + + #{USER_ID}, + #{USERNAME}, + #{PASSWORD}, + #{NAME}, + #{ROLE_ID}, + #{LAST_LOGIN}, + #{IP}, + #{STATUS}, + #{BZ}, + #{SKIN}, + #{EMAIL}, + #{NUMBER}, + #{PHONE}, + #{ROLE_IDS}, + #{DEPARTMENT_ID}, + #{POST_ID}, + #{ISMAIN}, + #{FUN_IDS}, + #{SORT}, + #{PERSON_TYPE}, + #{IS_HAZARDCONFIRMER}, + #{IS_ONLINELEARNING}, + #{LEARNERCATEGORY}, + #{USERAVATARPREFIX}, + #{USERAVATARURL}, + #{SHIFTDUTYONE}, + #{SHIFTDUTYTWO}, + #{DURATION}, + #{WORKSTATUS}, + #{WORKPERIOD}, + #{JCR}, + #{CORPINFO_ID}, + #{CARDNO}, + #{ISDELETE} + + + + insert into sys_user ( + + ) values ( + + ) + + + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/BusImgfilesDao.xml b/review_repo/src/main/resources/mapper/sys/BusImgfilesDao.xml new file mode 100644 index 0000000..e6f6bc3 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/BusImgfilesDao.xml @@ -0,0 +1,29 @@ + + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysConfigDao.xml b/review_repo/src/main/resources/mapper/sys/SysConfigDao.xml new file mode 100644 index 0000000..676df88 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysConfigDao.xml @@ -0,0 +1,15 @@ + + + + + + + update sys_config set param_value = #{paramValue} where param_key = #{paramKey} + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysDictionariesDao.xml b/review_repo/src/main/resources/mapper/sys/SysDictionariesDao.xml new file mode 100644 index 0000000..f89bab6 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysDictionariesDao.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysLogDao.xml b/review_repo/src/main/resources/mapper/sys/SysLogDao.xml new file mode 100644 index 0000000..332c3e8 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysLogDao.xml @@ -0,0 +1,19 @@ + + + + + + CREATE TABLE IF NOT EXISTS ${tableName} LIKE sys_log; + + + + INSERT INTO ${tableName} (id, username, operation, method, params, time, ip, create_date, corpinfo_id) + VALUES (#{logEntity.id}, #{logEntity.username}, #{logEntity.operation}, #{logEntity.method}, + #{logEntity.params}, #{logEntity.time}, #{logEntity.ip}, #{logEntity.createDate}, #{logEntity.corpinfoId}) + + diff --git a/review_repo/src/main/resources/mapper/sys/SysMenuDao.xml b/review_repo/src/main/resources/mapper/sys/SysMenuDao.xml new file mode 100644 index 0000000..403af06 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysMenuDao.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysRoleDao.xml b/review_repo/src/main/resources/mapper/sys/SysRoleDao.xml new file mode 100644 index 0000000..0c5dc41 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysRoleDao.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysRoleMenuDao.xml b/review_repo/src/main/resources/mapper/sys/SysRoleMenuDao.xml new file mode 100644 index 0000000..3c35573 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysRoleMenuDao.xml @@ -0,0 +1,17 @@ + + + + + + + + + delete from sys_role_menu where role_id in + + #{roleId} + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysUserDao.xml b/review_repo/src/main/resources/mapper/sys/SysUserDao.xml new file mode 100644 index 0000000..b3e6dfc --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysUserDao.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysUserRoleDao.xml b/review_repo/src/main/resources/mapper/sys/SysUserRoleDao.xml new file mode 100644 index 0000000..6d9221f --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysUserRoleDao.xml @@ -0,0 +1,16 @@ + + + + + + + delete from sys_user_role where role_id in + + #{roleId} + + + + + diff --git a/review_repo/src/main/resources/mapper/sys/SysUserTokenDao.xml b/review_repo/src/main/resources/mapper/sys/SysUserTokenDao.xml new file mode 100644 index 0000000..f76fe94 --- /dev/null +++ b/review_repo/src/main/resources/mapper/sys/SysUserTokenDao.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/review_repo/src/main/resources/mapper/task/AlarmInfoMapper.xml b/review_repo/src/main/resources/mapper/task/AlarmInfoMapper.xml new file mode 100644 index 0000000..a9b805c --- /dev/null +++ b/review_repo/src/main/resources/mapper/task/AlarmInfoMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/task/AnemometerMachineMapper.xml b/review_repo/src/main/resources/mapper/task/AnemometerMachineMapper.xml new file mode 100644 index 0000000..ce0a150 --- /dev/null +++ b/review_repo/src/main/resources/mapper/task/AnemometerMachineMapper.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/task/AnemometerRecordMapper.xml b/review_repo/src/main/resources/mapper/task/AnemometerRecordMapper.xml new file mode 100644 index 0000000..5977a95 --- /dev/null +++ b/review_repo/src/main/resources/mapper/task/AnemometerRecordMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/review_repo/src/main/resources/mapper/task/DjCarLogMapper.xml b/review_repo/src/main/resources/mapper/task/DjCarLogMapper.xml new file mode 100644 index 0000000..9ffa124 --- /dev/null +++ b/review_repo/src/main/resources/mapper/task/DjCarLogMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/review_repo/src/main/resources/mapper/task/DjPersonLogMapper.xml b/review_repo/src/main/resources/mapper/task/DjPersonLogMapper.xml new file mode 100644 index 0000000..4e117c1 --- /dev/null +++ b/review_repo/src/main/resources/mapper/task/DjPersonLogMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/review_repo/src/main/resources/mapper/task/MkmjDoorMapper.xml b/review_repo/src/main/resources/mapper/task/MkmjDoorMapper.xml new file mode 100644 index 0000000..92b0e36 --- /dev/null +++ b/review_repo/src/main/resources/mapper/task/MkmjDoorMapper.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/review_repo/src/main/resources/mapper/util/PersonLocationTokenMapper.xml b/review_repo/src/main/resources/mapper/util/PersonLocationTokenMapper.xml new file mode 100644 index 0000000..934bae6 --- /dev/null +++ b/review_repo/src/main/resources/mapper/util/PersonLocationTokenMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + update + BUS_PERSON_LOCATION_TOKEN + set + TOKEN = #{TOKEN} + + + + + + diff --git a/review_repo/src/main/resources/static/courseware.png b/review_repo/src/main/resources/static/courseware.png new file mode 100644 index 0000000..a421cc6 Binary files /dev/null and b/review_repo/src/main/resources/static/courseware.png differ diff --git a/review_repo/src/main/resources/static/favicon.ico b/review_repo/src/main/resources/static/favicon.ico new file mode 100644 index 0000000..2bd581c Binary files /dev/null and b/review_repo/src/main/resources/static/favicon.ico differ diff --git a/review_repo/src/main/resources/static/questionExcelTemplate.xls b/review_repo/src/main/resources/static/questionExcelTemplate.xls new file mode 100644 index 0000000..261bdba Binary files /dev/null and b/review_repo/src/main/resources/static/questionExcelTemplate.xls differ diff --git a/review_repo/src/main/resources/static/swagger/css/print.css b/review_repo/src/main/resources/static/swagger/css/print.css new file mode 100644 index 0000000..f2e8446 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/css/print.css @@ -0,0 +1 @@ +.swagger-section pre code{display:block;padding:.5em;background:#f0f0f0}.swagger-section pre .clojure .built_in,.swagger-section pre .lisp .title,.swagger-section pre .nginx .title,.swagger-section pre .subst,.swagger-section pre .tag .title,.swagger-section pre code{color:#000}.swagger-section pre .addition,.swagger-section pre .aggregate,.swagger-section pre .apache .cbracket,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .constant,.swagger-section pre .django .variable,.swagger-section pre .erlang_repl .function_or_atom,.swagger-section pre .flow,.swagger-section pre .markdown .header,.swagger-section pre .parent,.swagger-section pre .preprocessor,.swagger-section pre .ruby .symbol,.swagger-section pre .ruby .symbol .string,.swagger-section pre .rules .value,.swagger-section pre .rules .value .number,.swagger-section pre .smalltalk .class,.swagger-section pre .stream,.swagger-section pre .string,.swagger-section pre .tag .value,.swagger-section pre .template_tag,.swagger-section pre .tex .command,.swagger-section pre .tex .special,.swagger-section pre .title{color:#800}.swagger-section pre .annotation,.swagger-section pre .chunk,.swagger-section pre .comment,.swagger-section pre .diff .header,.swagger-section pre .markdown .blockquote,.swagger-section pre .template_comment{color:#888}.swagger-section pre .change,.swagger-section pre .date,.swagger-section pre .go .constant,.swagger-section pre .literal,.swagger-section pre .markdown .bullet,.swagger-section pre .markdown .link_url,.swagger-section pre .number,.swagger-section pre .regexp,.swagger-section pre .smalltalk .char,.swagger-section pre .smalltalk .symbol{color:#080}.swagger-section pre .apache .sqbracket,.swagger-section pre .array,.swagger-section pre .attr_selector,.swagger-section pre .clojure .attribute,.swagger-section pre .coffeescript .property,.swagger-section pre .decorator,.swagger-section pre .deletion,.swagger-section pre .doctype,.swagger-section pre .envvar,.swagger-section pre .erlang_repl .reserved,.swagger-section pre .filter .argument,.swagger-section pre .important,.swagger-section pre .javadoc,.swagger-section pre .label,.swagger-section pre .localvars,.swagger-section pre .markdown .link_label,.swagger-section pre .nginx .built_in,.swagger-section pre .pi,.swagger-section pre .prompt,.swagger-section pre .pseudo,.swagger-section pre .ruby .string,.swagger-section pre .shebang,.swagger-section pre .tex .formula,.swagger-section pre .vhdl .attribute{color:#88f}.swagger-section pre .aggregate,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .built_in,.swagger-section pre .css .tag,.swagger-section pre .go .typename,.swagger-section pre .id,.swagger-section pre .javadoctag,.swagger-section pre .keyword,.swagger-section pre .markdown .strong,.swagger-section pre .phpdoc,.swagger-section pre .request,.swagger-section pre .smalltalk .class,.swagger-section pre .status,.swagger-section pre .tex .command,.swagger-section pre .title,.swagger-section pre .winutils,.swagger-section pre .yardoctag{font-weight:700}.swagger-section pre .markdown .emphasis{font-style:italic}.swagger-section pre .nginx .built_in{font-weight:400}.swagger-section pre .coffeescript .javascript,.swagger-section pre .javascript .xml,.swagger-section pre .tex .formula,.swagger-section pre .xml .cdata,.swagger-section pre .xml .css,.swagger-section pre .xml .javascript,.swagger-section pre .xml .vbscript{opacity:.5}.swagger-section .hljs{display:block;overflow-x:auto;padding:.5em;background:#f0f0f0}.swagger-section .hljs,.swagger-section .hljs-subst{color:#444}.swagger-section .hljs-attribute,.swagger-section .hljs-doctag,.swagger-section .hljs-keyword,.swagger-section .hljs-meta-keyword,.swagger-section .hljs-name,.swagger-section .hljs-selector-tag{font-weight:700}.swagger-section .hljs-addition,.swagger-section .hljs-built_in,.swagger-section .hljs-bullet,.swagger-section .hljs-code,.swagger-section .hljs-literal{color:#1f811f}.swagger-section .hljs-link,.swagger-section .hljs-regexp,.swagger-section .hljs-selector-attr,.swagger-section .hljs-selector-pseudo,.swagger-section .hljs-symbol,.swagger-section .hljs-template-variable,.swagger-section .hljs-variable{color:#bc6060}.swagger-section .hljs-deletion,.swagger-section .hljs-number,.swagger-section .hljs-quote,.swagger-section .hljs-selector-class,.swagger-section .hljs-selector-id,.swagger-section .hljs-string,.swagger-section .hljs-template-tag,.swagger-section .hljs-type{color:#800}.swagger-section .hljs-section,.swagger-section .hljs-title{color:#800;font-weight:700}.swagger-section .hljs-comment{color:#888}.swagger-section .hljs-meta{color:#2b6ea1}.swagger-section .hljs-emphasis{font-style:italic}.swagger-section .hljs-strong{font-weight:700}.swagger-section .swagger-ui-wrap{line-height:1;font-family:Droid Sans,sans-serif;min-width:760px;max-width:960px;margin-left:auto;margin-right:auto}.swagger-section .swagger-ui-wrap b,.swagger-section .swagger-ui-wrap strong{font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap blockquote,.swagger-section .swagger-ui-wrap q{quotes:none}.swagger-section .swagger-ui-wrap p{line-height:1.4em;padding:0 0 10px;color:#333}.swagger-section .swagger-ui-wrap blockquote:after,.swagger-section .swagger-ui-wrap blockquote:before,.swagger-section .swagger-ui-wrap q:after,.swagger-section .swagger-ui-wrap q:before{content:none}.swagger-section .swagger-ui-wrap .heading_with_menu h1,.swagger-section .swagger-ui-wrap .heading_with_menu h2,.swagger-section .swagger-ui-wrap .heading_with_menu h3,.swagger-section .swagger-ui-wrap .heading_with_menu h4,.swagger-section .swagger-ui-wrap .heading_with_menu h5,.swagger-section .swagger-ui-wrap .heading_with_menu h6{display:block;clear:none;float:left;-ms-box-sizing:border-box;box-sizing:border-box;width:60%}.swagger-section .swagger-ui-wrap table{border-collapse:collapse;border-spacing:0}.swagger-section .swagger-ui-wrap table thead tr th{padding:5px;font-size:.9em;color:#666;border-bottom:1px solid #999}.swagger-section .swagger-ui-wrap table tbody tr:last-child td{border-bottom:none}.swagger-section .swagger-ui-wrap table tbody tr.offset{background-color:#f0f0f0}.swagger-section .swagger-ui-wrap table tbody tr td{padding:6px;font-size:.9em;border-bottom:1px solid #ccc;vertical-align:top;line-height:1.3em}.swagger-section .swagger-ui-wrap ol{margin:0 0 10px;padding:0 0 0 18px;list-style-type:decimal}.swagger-section .swagger-ui-wrap ol li{padding:5px 0;font-size:.9em;color:#333}.swagger-section .swagger-ui-wrap ol,.swagger-section .swagger-ui-wrap ul{list-style:none}.swagger-section .swagger-ui-wrap h1 a,.swagger-section .swagger-ui-wrap h2 a,.swagger-section .swagger-ui-wrap h3 a,.swagger-section .swagger-ui-wrap h4 a,.swagger-section .swagger-ui-wrap h5 a,.swagger-section .swagger-ui-wrap h6 a{text-decoration:none}.swagger-section .swagger-ui-wrap h1 a:hover,.swagger-section .swagger-ui-wrap h2 a:hover,.swagger-section .swagger-ui-wrap h3 a:hover,.swagger-section .swagger-ui-wrap h4 a:hover,.swagger-section .swagger-ui-wrap h5 a:hover,.swagger-section .swagger-ui-wrap h6 a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap h1 span.divider,.swagger-section .swagger-ui-wrap h2 span.divider,.swagger-section .swagger-ui-wrap h3 span.divider,.swagger-section .swagger-ui-wrap h4 span.divider,.swagger-section .swagger-ui-wrap h5 span.divider,.swagger-section .swagger-ui-wrap h6 span.divider{color:#aaa}.swagger-section .swagger-ui-wrap a{color:#547f00}.swagger-section .swagger-ui-wrap a img{border:none}.swagger-section .swagger-ui-wrap article,.swagger-section .swagger-ui-wrap aside,.swagger-section .swagger-ui-wrap details,.swagger-section .swagger-ui-wrap figcaption,.swagger-section .swagger-ui-wrap figure,.swagger-section .swagger-ui-wrap footer,.swagger-section .swagger-ui-wrap header,.swagger-section .swagger-ui-wrap hgroup,.swagger-section .swagger-ui-wrap menu,.swagger-section .swagger-ui-wrap nav,.swagger-section .swagger-ui-wrap section,.swagger-section .swagger-ui-wrap summary{display:block}.swagger-section .swagger-ui-wrap pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px}.swagger-section .swagger-ui-wrap pre code{line-height:1.6em;background:none}.swagger-section .swagger-ui-wrap .content>.content-type>div>label{clear:both;display:block;color:#0f6ab4;font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap .content pre{font-size:12px;margin-top:5px;padding:5px}.swagger-section .swagger-ui-wrap .icon-btn{cursor:pointer}.swagger-section .swagger-ui-wrap .info_title{padding-bottom:10px;font-weight:700;font-size:25px}.swagger-section .swagger-ui-wrap .footer{margin-top:20px}.swagger-section .swagger-ui-wrap div.big p,.swagger-section .swagger-ui-wrap p.big{font-size:1em;margin-bottom:10px}.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea,.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input{width:500px!important}.swagger-section .swagger-ui-wrap .info_license,.swagger-section .swagger-ui-wrap .info_tos{padding-bottom:5px}.swagger-section .swagger-ui-wrap .message-fail{color:#c00}.swagger-section .swagger-ui-wrap .info_email,.swagger-section .swagger-ui-wrap .info_name,.swagger-section .swagger-ui-wrap .info_url{padding-bottom:5px}.swagger-section .swagger-ui-wrap .info_description{padding-bottom:10px;font-size:15px}.swagger-section .swagger-ui-wrap .markdown ol li,.swagger-section .swagger-ui-wrap .markdown ul li{padding:3px 0;line-height:1.4em;color:#333}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input{display:block;padding:4px;width:auto;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title{font-size:1.3em}.swagger-section .swagger-ui-wrap table.fullwidth{width:100%}.swagger-section .swagger-ui-wrap .model-signature{font-family:Droid Sans,sans-serif;font-size:1em;line-height:1.5em}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a{text-decoration:none;color:#aaa}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap .model-signature .propType{color:#55a}.swagger-section .swagger-ui-wrap .model-signature pre:hover{background-color:#ffd}.swagger-section .swagger-ui-wrap .model-signature pre{font-size:.85em;line-height:1.2em;overflow:auto;height:200px;resize:vertical;cursor:pointer}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav{display:block;min-width:230px;margin:0;padding:0}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li{float:left;margin:0 5px 5px 0;padding:2px 5px 2px 0;border-right:1px solid #ddd}.swagger-section .swagger-ui-wrap .model-signature .propOpt{color:#555}.swagger-section .swagger-ui-wrap .model-signature .snippet small{font-size:.75em}.swagger-section .swagger-ui-wrap .model-signature .propOptKey{font-style:italic}.swagger-section .swagger-ui-wrap .model-signature .description .strong{font-weight:700;color:#000;font-size:.9em}.swagger-section .swagger-ui-wrap .model-signature .description div{font-size:.9em;line-height:1.5em;margin-left:1em}.swagger-section .swagger-ui-wrap .model-signature .description .stronger{font-weight:700;color:#000}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper{border-spacing:0;position:absolute;background-color:#fff;border:1px solid #bbb;display:none;font-size:11px;max-width:400px;line-height:30px;color:#000;padding:5px;margin-left:10px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th{text-align:center;background-color:#eee;border:1px solid #bbb;font-size:11px;color:#666;font-weight:700;padding:5px;line-height:15px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:first-child,.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:last-child{display:inline}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:not(:first-child):before{display:block;content:''}.swagger-section .swagger-ui-wrap .model-signature .description span:last-of-type.propDesc.markdown>p:only-child{margin-right:-3px}.swagger-section .swagger-ui-wrap .model-signature .propName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .signature-container{clear:both}.swagger-section .swagger-ui-wrap .body-textarea{width:300px;height:100px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap .markdown li code,.swagger-section .swagger-ui-wrap .markdown p code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#f0f0f0;color:#000;padding:1px 3px}.swagger-section .swagger-ui-wrap .required{font-weight:700}.swagger-section .swagger-ui-wrap .editor_holder{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em}.swagger-section .swagger-ui-wrap .editor_holder label{font-weight:400!important}.swagger-section .swagger-ui-wrap .editor_holder label.required{font-weight:700!important}.swagger-section .swagger-ui-wrap input.parameter{width:300px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap h1{color:#000;font-size:1.5em;line-height:1.3em;padding:10px 0;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap .heading_with_menu{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap .heading_with_menu ul{display:block;clear:none;float:right;-ms-box-sizing:border-box;box-sizing:border-box;margin-top:10px}.swagger-section .swagger-ui-wrap h2{color:#000;font-size:1.3em;padding:10px 0}.swagger-section .swagger-ui-wrap h2 a{color:#000}.swagger-section .swagger-ui-wrap h2 span.sub{font-size:.7em;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap h2 span.sub a{color:#777}.swagger-section .swagger-ui-wrap span.weak{color:#666}.swagger-section .swagger-ui-wrap .message-success{color:#89bf04}.swagger-section .swagger-ui-wrap caption,.swagger-section .swagger-ui-wrap td,.swagger-section .swagger-ui-wrap th{text-align:left;font-weight:400;vertical-align:middle}.swagger-section .swagger-ui-wrap .code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea{font-family:Droid Sans,sans-serif;height:250px;padding:4px;display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select{display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label{display:block;float:left;clear:none;margin:0;padding:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input{display:block;float:left;clear:none;margin:0 5px 0 0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label{color:#000}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label{display:block;clear:both;width:auto;padding:0 0 3px;color:#666}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr{padding-left:3px;color:#888}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints{margin-left:0;font-style:italic;font-size:.9em;margin:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons{margin:0;padding:0}.swagger-section .swagger-ui-wrap span.blank,.swagger-section .swagger-ui-wrap span.empty{color:#888;font-style:italic}.swagger-section .swagger-ui-wrap .markdown h3{color:#547f00}.swagger-section .swagger-ui-wrap .markdown h4{color:#666}.swagger-section .swagger-ui-wrap .markdown pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px;margin:0 0 10px}.swagger-section .swagger-ui-wrap .markdown pre code{line-height:1.6em;overflow:auto}.swagger-section .swagger-ui-wrap div.gist{margin:20px 0 25px!important}.swagger-section .swagger-ui-wrap ul#resources{font-family:Droid Sans,sans-serif;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource{border-bottom:1px solid #ddd}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a{color:#555}.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child{border-bottom:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading{border:1px solid transparent;float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:14px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;border-right:1px solid #ddd;color:#666;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a{color:#aaa;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#999;padding-left:0;display:block;clear:none;float:left;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#999}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation{float:none;clear:both;overflow:hidden;display:block;margin:0 0 10px;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading{float:none;clear:both;overflow:hidden;display:block;margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3{display:block;clear:none;float:left;width:auto;margin:0;padding:0;line-height:1.1em;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path{padding-left:10px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a.toggleOperation.deprecated{text-decoration:line-through}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a{text-transform:uppercase;text-decoration:none;color:#fff;display:inline-block;width:50px;font-size:.7em;text-align:center;padding:7px 0 4px;border-radius:2px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span{margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:6px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a{text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p{color:inherit;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .nickname{color:#aaa;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content{border-top:none;padding:10px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:0 0 20px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4{font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a{padding:4px 0 0 10px;display:inline-block;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit{display:block;clear:none;float:left;padding:6px 8px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber{background-image:url(../images/throbber.gif);width:128px;height:16px;display:block;clear:none;float:right}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type=text].error{outline:2px solid #000;outline-color:#c00}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form select[name=parameterContentType]{max-width:300px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;padding:10px;font-size:.9em;max-height:400px;overflow-y:auto}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading{background-color:#f9f2e9;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a{background-color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0e0ca;color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{background-color:#faf5ee;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a{text-transform:uppercase;background-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#ffd20f;color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading{background-color:#f5e8e8;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a{text-transform:uppercase;background-color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#e8c6c7;color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content{background-color:#f7eded;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a{color:#c8787a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading{background-color:#e7f6ec;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a{background-color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3e8d1;color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content{background-color:#ebf7f0;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading{background-color:#fce9e3;border:1px solid #f5d5c3}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a{background-color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0cecb;color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content{background-color:#faf0ef;border:1px solid #f0cecb}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{border-top:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap p#colophon{margin:0 15px 40px;padding:10px 0;font-size:.8em;border-top:1px solid #ddd;font-family:Droid Sans,sans-serif;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap p#colophon a{text-decoration:none;color:#547f00}.swagger-section .swagger-ui-wrap h3{color:#000;font-size:1.1em;padding:10px 0}.swagger-section .swagger-ui-wrap .markdown ol,.swagger-section .swagger-ui-wrap .markdown ul{font-family:Droid Sans,sans-serif;margin:5px 0 10px;padding:0 0 0 18px;list-style-type:disc}.swagger-section .swagger-ui-wrap form.form_box{background-color:#ebf3f9;border:1px solid #c3d9ec;padding:10px}.swagger-section .swagger-ui-wrap form.form_box label{color:#0f6ab4!important}.swagger-section .swagger-ui-wrap form.form_box input[type=submit]{display:block;padding:10px}.swagger-section .swagger-ui-wrap form.form_box p.weak{font-size:.8em}.swagger-section .swagger-ui-wrap form.form_box p{font-size:.9em;padding:0 0 15px;color:#7e7b6d}.swagger-section .swagger-ui-wrap form.form_box p a{color:#646257}.swagger-section .swagger-ui-wrap form.form_box p strong{color:#000}.swagger-section .swagger-ui-wrap .operation-status td.markdown>p:last-child{padding-bottom:0}.swagger-section .title{font-style:bold}.swagger-section .secondary_form{display:none}.swagger-section .main_image{display:block;margin-left:auto;margin-right:auto}.swagger-section .oauth_body{margin-left:100px;margin-right:100px}.swagger-section .oauth_submit{text-align:center;display:inline-block}.swagger-section .authorize-wrapper{margin:15px 0 10px}.swagger-section .authorize-wrapper_operation{float:right}.swagger-section .authorize__btn:hover{text-decoration:underline;cursor:pointer}.swagger-section .authorize__btn_operation:hover .authorize-scopes{display:block}.swagger-section .authorize-scopes{position:absolute;margin-top:20px;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;font-size:13px;max-width:300px;line-height:30px;color:#000;padding:5px}.swagger-section .authorize-scopes .authorize__scope{text-decoration:none}.swagger-section .authorize__btn_operation{height:18px;vertical-align:middle;display:inline-block;background:url(../images/explorer_icons.png) no-repeat}.swagger-section .authorize__btn_operation_login{background-position:0 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .authorize__btn_operation_logout{background-position:-30px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section #auth_container{color:#fff;display:inline-block;border:none;padding:5px;width:87px;height:13px}.swagger-section #auth_container .authorize__btn{color:#fff}.swagger-section .auth_container{padding:0 0 10px;margin-bottom:5px;border-bottom:1px solid #ccc;font-size:.9em}.swagger-section .auth_container .auth__title{color:#547f00;font-size:1.2em}.swagger-section .auth_container .basic_auth__label{display:inline-block;width:60px}.swagger-section .auth_container .auth__description{color:#999;margin-bottom:5px}.swagger-section .auth_container .auth__button{margin-top:10px;height:30px}.swagger-section .auth_container .key_auth__field{margin:5px 0}.swagger-section .auth_container .key_auth__label{display:inline-block;width:60px}.swagger-section .api-popup-dialog{position:absolute;display:none}.swagger-section .api-popup-dialog-wrapper{z-index:2;width:500px;background:#fff;padding:20px;border:1px solid #ccc;border-radius:5px;font-size:13px;color:#777;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.swagger-section .api-popup-dialog-shadow{position:fixed;top:0;left:0;width:100%;height:100%;opacity:.2;background-color:gray;z-index:1}.swagger-section .api-popup-dialog .api-popup-title{font-size:24px;padding:10px 0}.swagger-section .api-popup-dialog .error-msg{padding-left:5px;padding-bottom:5px}.swagger-section .api-popup-dialog .api-popup-content{max-height:500px;overflow-y:auto}.swagger-section .api-popup-dialog .api-popup-authbtn,.swagger-section .api-popup-dialog .api-popup-cancel{height:30px}.swagger-section .api-popup-scopes{padding:10px 20px}.swagger-section .api-popup-scopes li{padding:5px 0;line-height:20px}.swagger-section .api-popup-scopes li input{position:relative;top:2px}.swagger-section .api-popup-scopes .api-scope-desc{padding-left:20px;font-style:italic}.swagger-section .api-popup-actions{padding-top:10px}.swagger-section fieldset{padding-bottom:10px;padding-left:20px}#header{display:none}.swagger-section .swagger-ui-wrap .model-signature pre{max-height:none}.swagger-section .swagger-ui-wrap .body-textarea,.swagger-section .swagger-ui-wrap input.parameter{width:100px}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options{display:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content{display:block!important} \ No newline at end of file diff --git a/review_repo/src/main/resources/static/swagger/css/reset.css b/review_repo/src/main/resources/static/swagger/css/reset.css new file mode 100644 index 0000000..40dc830 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/css/reset.css @@ -0,0 +1 @@ +a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0} \ No newline at end of file diff --git a/review_repo/src/main/resources/static/swagger/css/screen.css b/review_repo/src/main/resources/static/swagger/css/screen.css new file mode 100644 index 0000000..1f069f6 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/css/screen.css @@ -0,0 +1 @@ +.swagger-section pre code{display:block;padding:.5em;background:#f0f0f0}.swagger-section pre .clojure .built_in,.swagger-section pre .lisp .title,.swagger-section pre .nginx .title,.swagger-section pre .subst,.swagger-section pre .tag .title,.swagger-section pre code{color:#000}.swagger-section pre .addition,.swagger-section pre .aggregate,.swagger-section pre .apache .cbracket,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .constant,.swagger-section pre .django .variable,.swagger-section pre .erlang_repl .function_or_atom,.swagger-section pre .flow,.swagger-section pre .markdown .header,.swagger-section pre .parent,.swagger-section pre .preprocessor,.swagger-section pre .ruby .symbol,.swagger-section pre .ruby .symbol .string,.swagger-section pre .rules .value,.swagger-section pre .rules .value .number,.swagger-section pre .smalltalk .class,.swagger-section pre .stream,.swagger-section pre .string,.swagger-section pre .tag .value,.swagger-section pre .template_tag,.swagger-section pre .tex .command,.swagger-section pre .tex .special,.swagger-section pre .title{color:#800}.swagger-section pre .annotation,.swagger-section pre .chunk,.swagger-section pre .comment,.swagger-section pre .diff .header,.swagger-section pre .markdown .blockquote,.swagger-section pre .template_comment{color:#888}.swagger-section pre .change,.swagger-section pre .date,.swagger-section pre .go .constant,.swagger-section pre .literal,.swagger-section pre .markdown .bullet,.swagger-section pre .markdown .link_url,.swagger-section pre .number,.swagger-section pre .regexp,.swagger-section pre .smalltalk .char,.swagger-section pre .smalltalk .symbol{color:#080}.swagger-section pre .apache .sqbracket,.swagger-section pre .array,.swagger-section pre .attr_selector,.swagger-section pre .clojure .attribute,.swagger-section pre .coffeescript .property,.swagger-section pre .decorator,.swagger-section pre .deletion,.swagger-section pre .doctype,.swagger-section pre .envvar,.swagger-section pre .erlang_repl .reserved,.swagger-section pre .filter .argument,.swagger-section pre .important,.swagger-section pre .javadoc,.swagger-section pre .label,.swagger-section pre .localvars,.swagger-section pre .markdown .link_label,.swagger-section pre .nginx .built_in,.swagger-section pre .pi,.swagger-section pre .prompt,.swagger-section pre .pseudo,.swagger-section pre .ruby .string,.swagger-section pre .shebang,.swagger-section pre .tex .formula,.swagger-section pre .vhdl .attribute{color:#88f}.swagger-section pre .aggregate,.swagger-section pre .apache .tag,.swagger-section pre .bash .variable,.swagger-section pre .built_in,.swagger-section pre .css .tag,.swagger-section pre .go .typename,.swagger-section pre .id,.swagger-section pre .javadoctag,.swagger-section pre .keyword,.swagger-section pre .markdown .strong,.swagger-section pre .phpdoc,.swagger-section pre .request,.swagger-section pre .smalltalk .class,.swagger-section pre .status,.swagger-section pre .tex .command,.swagger-section pre .title,.swagger-section pre .winutils,.swagger-section pre .yardoctag{font-weight:700}.swagger-section pre .markdown .emphasis{font-style:italic}.swagger-section pre .nginx .built_in{font-weight:400}.swagger-section pre .coffeescript .javascript,.swagger-section pre .javascript .xml,.swagger-section pre .tex .formula,.swagger-section pre .xml .cdata,.swagger-section pre .xml .css,.swagger-section pre .xml .javascript,.swagger-section pre .xml .vbscript{opacity:.5}.swagger-section .hljs{display:block;overflow-x:auto;padding:.5em;background:#f0f0f0}.swagger-section .hljs,.swagger-section .hljs-subst{color:#444}.swagger-section .hljs-attribute,.swagger-section .hljs-doctag,.swagger-section .hljs-keyword,.swagger-section .hljs-meta-keyword,.swagger-section .hljs-name,.swagger-section .hljs-selector-tag{font-weight:700}.swagger-section .hljs-addition,.swagger-section .hljs-built_in,.swagger-section .hljs-bullet,.swagger-section .hljs-code,.swagger-section .hljs-literal{color:#1f811f}.swagger-section .hljs-link,.swagger-section .hljs-regexp,.swagger-section .hljs-selector-attr,.swagger-section .hljs-selector-pseudo,.swagger-section .hljs-symbol,.swagger-section .hljs-template-variable,.swagger-section .hljs-variable{color:#bc6060}.swagger-section .hljs-deletion,.swagger-section .hljs-number,.swagger-section .hljs-quote,.swagger-section .hljs-selector-class,.swagger-section .hljs-selector-id,.swagger-section .hljs-string,.swagger-section .hljs-template-tag,.swagger-section .hljs-type{color:#800}.swagger-section .hljs-section,.swagger-section .hljs-title{color:#800;font-weight:700}.swagger-section .hljs-comment{color:#888}.swagger-section .hljs-meta{color:#2b6ea1}.swagger-section .hljs-emphasis{font-style:italic}.swagger-section .hljs-strong{font-weight:700}.swagger-section .swagger-ui-wrap{line-height:1;font-family:Droid Sans,sans-serif;min-width:760px;max-width:960px;margin-left:auto;margin-right:auto}.swagger-section .swagger-ui-wrap b,.swagger-section .swagger-ui-wrap strong{font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap blockquote,.swagger-section .swagger-ui-wrap q{quotes:none}.swagger-section .swagger-ui-wrap p{line-height:1.4em;padding:0 0 10px;color:#333}.swagger-section .swagger-ui-wrap blockquote:after,.swagger-section .swagger-ui-wrap blockquote:before,.swagger-section .swagger-ui-wrap q:after,.swagger-section .swagger-ui-wrap q:before{content:none}.swagger-section .swagger-ui-wrap .heading_with_menu h1,.swagger-section .swagger-ui-wrap .heading_with_menu h2,.swagger-section .swagger-ui-wrap .heading_with_menu h3,.swagger-section .swagger-ui-wrap .heading_with_menu h4,.swagger-section .swagger-ui-wrap .heading_with_menu h5,.swagger-section .swagger-ui-wrap .heading_with_menu h6{display:block;clear:none;float:left;-ms-box-sizing:border-box;box-sizing:border-box;width:60%}.swagger-section .swagger-ui-wrap table{border-collapse:collapse;border-spacing:0}.swagger-section .swagger-ui-wrap table thead tr th{padding:5px;font-size:.9em;color:#666;border-bottom:1px solid #999}.swagger-section .swagger-ui-wrap table tbody tr:last-child td{border-bottom:none}.swagger-section .swagger-ui-wrap table tbody tr.offset{background-color:#f0f0f0}.swagger-section .swagger-ui-wrap table tbody tr td{padding:6px;font-size:.9em;border-bottom:1px solid #ccc;vertical-align:top;line-height:1.3em}.swagger-section .swagger-ui-wrap ol{margin:0 0 10px;padding:0 0 0 18px;list-style-type:decimal}.swagger-section .swagger-ui-wrap ol li{padding:5px 0;font-size:.9em;color:#333}.swagger-section .swagger-ui-wrap ol,.swagger-section .swagger-ui-wrap ul{list-style:none}.swagger-section .swagger-ui-wrap h1 a,.swagger-section .swagger-ui-wrap h2 a,.swagger-section .swagger-ui-wrap h3 a,.swagger-section .swagger-ui-wrap h4 a,.swagger-section .swagger-ui-wrap h5 a,.swagger-section .swagger-ui-wrap h6 a{text-decoration:none}.swagger-section .swagger-ui-wrap h1 a:hover,.swagger-section .swagger-ui-wrap h2 a:hover,.swagger-section .swagger-ui-wrap h3 a:hover,.swagger-section .swagger-ui-wrap h4 a:hover,.swagger-section .swagger-ui-wrap h5 a:hover,.swagger-section .swagger-ui-wrap h6 a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap h1 span.divider,.swagger-section .swagger-ui-wrap h2 span.divider,.swagger-section .swagger-ui-wrap h3 span.divider,.swagger-section .swagger-ui-wrap h4 span.divider,.swagger-section .swagger-ui-wrap h5 span.divider,.swagger-section .swagger-ui-wrap h6 span.divider{color:#aaa}.swagger-section .swagger-ui-wrap a{color:#547f00}.swagger-section .swagger-ui-wrap a img{border:none}.swagger-section .swagger-ui-wrap article,.swagger-section .swagger-ui-wrap aside,.swagger-section .swagger-ui-wrap details,.swagger-section .swagger-ui-wrap figcaption,.swagger-section .swagger-ui-wrap figure,.swagger-section .swagger-ui-wrap footer,.swagger-section .swagger-ui-wrap header,.swagger-section .swagger-ui-wrap hgroup,.swagger-section .swagger-ui-wrap menu,.swagger-section .swagger-ui-wrap nav,.swagger-section .swagger-ui-wrap section,.swagger-section .swagger-ui-wrap summary{display:block}.swagger-section .swagger-ui-wrap pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px}.swagger-section .swagger-ui-wrap pre code{line-height:1.6em;background:none}.swagger-section .swagger-ui-wrap .content>.content-type>div>label{clear:both;display:block;color:#0f6ab4;font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap .content pre{font-size:12px;margin-top:5px;padding:5px}.swagger-section .swagger-ui-wrap .icon-btn{cursor:pointer}.swagger-section .swagger-ui-wrap .info_title{padding-bottom:10px;font-weight:700;font-size:25px}.swagger-section .swagger-ui-wrap .footer{margin-top:20px}.swagger-section .swagger-ui-wrap div.big p,.swagger-section .swagger-ui-wrap p.big{font-size:1em;margin-bottom:10px}.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input,.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea,.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input{width:500px!important}.swagger-section .swagger-ui-wrap .info_license,.swagger-section .swagger-ui-wrap .info_tos{padding-bottom:5px}.swagger-section .swagger-ui-wrap .message-fail{color:#c00}.swagger-section .swagger-ui-wrap .info_email,.swagger-section .swagger-ui-wrap .info_name,.swagger-section .swagger-ui-wrap .info_url{padding-bottom:5px}.swagger-section .swagger-ui-wrap .info_description{padding-bottom:10px;font-size:15px}.swagger-section .swagger-ui-wrap .markdown ol li,.swagger-section .swagger-ui-wrap .markdown ul li{padding:3px 0;line-height:1.4em;color:#333}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input{display:block;padding:4px;width:auto;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title,.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title{font-size:1.3em}.swagger-section .swagger-ui-wrap table.fullwidth{width:100%}.swagger-section .swagger-ui-wrap .model-signature{font-family:Droid Sans,sans-serif;font-size:1em;line-height:1.5em}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a{text-decoration:none;color:#aaa}.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap .model-signature .propType{color:#55a}.swagger-section .swagger-ui-wrap .model-signature pre:hover{background-color:#ffd}.swagger-section .swagger-ui-wrap .model-signature pre{font-size:.85em;line-height:1.2em;overflow:auto;height:200px;resize:vertical;cursor:pointer}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav{display:block;min-width:230px;margin:0;padding:0}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li{float:left;margin:0 5px 5px 0;padding:2px 5px 2px 0;border-right:1px solid #ddd}.swagger-section .swagger-ui-wrap .model-signature .propOpt{color:#555}.swagger-section .swagger-ui-wrap .model-signature .snippet small{font-size:.75em}.swagger-section .swagger-ui-wrap .model-signature .propOptKey{font-style:italic}.swagger-section .swagger-ui-wrap .model-signature .description .strong{font-weight:700;color:#000;font-size:.9em}.swagger-section .swagger-ui-wrap .model-signature .description div{font-size:.9em;line-height:1.5em;margin-left:1em}.swagger-section .swagger-ui-wrap .model-signature .description .stronger{font-weight:700;color:#000}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper{border-spacing:0;position:absolute;background-color:#fff;border:1px solid #bbb;display:none;font-size:11px;max-width:400px;line-height:30px;color:#000;padding:5px;margin-left:10px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th{text-align:center;background-color:#eee;border:1px solid #bbb;font-size:11px;color:#666;font-weight:700;padding:5px;line-height:15px}.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:first-child,.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:last-child{display:inline}.swagger-section .swagger-ui-wrap .model-signature .description .propDesc.markdown>p:not(:first-child):before{display:block;content:''}.swagger-section .swagger-ui-wrap .model-signature .description span:last-of-type.propDesc.markdown>p:only-child{margin-right:-3px}.swagger-section .swagger-ui-wrap .model-signature .propName{font-weight:700}.swagger-section .swagger-ui-wrap .model-signature .signature-container{clear:both}.swagger-section .swagger-ui-wrap .body-textarea{width:300px;height:100px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap .markdown li code,.swagger-section .swagger-ui-wrap .markdown p code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#f0f0f0;color:#000;padding:1px 3px}.swagger-section .swagger-ui-wrap .required{font-weight:700}.swagger-section .swagger-ui-wrap .editor_holder{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em}.swagger-section .swagger-ui-wrap .editor_holder label{font-weight:400!important}.swagger-section .swagger-ui-wrap .editor_holder label.required{font-weight:700!important}.swagger-section .swagger-ui-wrap input.parameter{width:300px;border:1px solid #aaa}.swagger-section .swagger-ui-wrap h1{color:#000;font-size:1.5em;line-height:1.3em;padding:10px 0;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap .heading_with_menu{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap .heading_with_menu ul{display:block;clear:none;float:right;-ms-box-sizing:border-box;box-sizing:border-box;margin-top:10px}.swagger-section .swagger-ui-wrap h2{color:#000;font-size:1.3em;padding:10px 0}.swagger-section .swagger-ui-wrap h2 a{color:#000}.swagger-section .swagger-ui-wrap h2 span.sub{font-size:.7em;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap h2 span.sub a{color:#777}.swagger-section .swagger-ui-wrap span.weak{color:#666}.swagger-section .swagger-ui-wrap .message-success{color:#89bf04}.swagger-section .swagger-ui-wrap caption,.swagger-section .swagger-ui-wrap td,.swagger-section .swagger-ui-wrap th{text-align:left;font-weight:400;vertical-align:middle}.swagger-section .swagger-ui-wrap .code{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea{font-family:Droid Sans,sans-serif;height:250px;padding:4px;display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select{display:block;clear:both}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label{display:block;float:left;clear:none;margin:0;padding:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input{display:block;float:left;clear:none;margin:0 5px 0 0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label{color:#000}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label{display:block;clear:both;width:auto;padding:0 0 3px;color:#666}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr{padding-left:3px;color:#888}.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints{margin-left:0;font-style:italic;font-size:.9em;margin:0}.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons{margin:0;padding:0}.swagger-section .swagger-ui-wrap span.blank,.swagger-section .swagger-ui-wrap span.empty{color:#888;font-style:italic}.swagger-section .swagger-ui-wrap .markdown h3{color:#547f00}.swagger-section .swagger-ui-wrap .markdown h4{color:#666}.swagger-section .swagger-ui-wrap .markdown pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;background-color:#fcf6db;border:1px solid #e5e0c6;padding:10px;margin:0 0 10px}.swagger-section .swagger-ui-wrap .markdown pre code{line-height:1.6em;overflow:auto}.swagger-section .swagger-ui-wrap div.gist{margin:20px 0 25px!important}.swagger-section .swagger-ui-wrap ul#resources{font-family:Droid Sans,sans-serif;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource{border-bottom:1px solid #ddd}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a,.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a{color:#555}.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child{border-bottom:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading{border:1px solid transparent;float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:14px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;border-right:1px solid #ddd;color:#666;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a{color:#aaa;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first,.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child{padding-left:0}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#999;padding-left:0;display:block;clear:none;float:left;font-family:Droid Sans,sans-serif;font-weight:700}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#999}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation{float:none;clear:both;overflow:hidden;display:block;margin:0 0 10px;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading{float:none;clear:both;overflow:hidden;display:block;margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3{display:block;clear:none;float:left;width:auto;margin:0;padding:0;line-height:1.1em;color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path{padding-left:10px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a{color:#000;text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a.toggleOperation.deprecated{text-decoration:line-through}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a{text-transform:uppercase;text-decoration:none;color:#fff;display:inline-block;width:50px;font-size:.7em;text-align:center;padding:7px 0 4px;border-radius:2px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span{margin:0;padding:0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options{overflow:hidden;padding:0;display:block;clear:none;float:right;margin:6px 10px 0 0}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li{float:left;clear:none;margin:0;padding:2px 10px;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a{text-decoration:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .markdown p{color:inherit;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .nickname{color:#aaa;padding:0;line-height:inherit}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content{border-top:none;padding:10px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:0 0 20px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4{font-size:1.1em;margin:0;padding:15px 0 5px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header{float:none;clear:both;overflow:hidden;display:block}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a{padding:4px 0 0 10px;display:inline-block;font-size:.9em}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit{display:block;clear:none;float:left;padding:6px 8px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber{background-image:url(../images/throbber.gif);width:128px;height:16px;display:block;clear:none;float:right}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type=text].error{outline:2px solid #000;outline-color:#c00}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form select[name=parameterContentType]{max-width:300px}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre{font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;padding:10px;font-size:.9em;max-height:400px;overflow-y:auto}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading{background-color:#f9f2e9;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a{background-color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0e0ca;color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{background-color:#faf5ee;border:1px solid #f0e0ca}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4{color:#c5862b}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a{text-transform:uppercase;background-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#ffd20f;color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content{background-color:#fcffcd;border:1px solid #000;border-color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4{color:#ffd20f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading{background-color:#f5e8e8;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a{text-transform:uppercase;background-color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#e8c6c7;color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content{background-color:#f7eded;border:1px solid #e8c6c7}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4{color:#a41e22}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a{color:#c8787a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading{background-color:#e7f6ec;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a{background-color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3e8d1;color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content{background-color:#ebf7f0;border:1px solid #c3e8d1}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4{color:#10a54a}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a{color:#6fc992}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading{background-color:#fce9e3;border:1px solid #f5d5c3}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a{background-color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#f0cecb;color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content{background-color:#faf0ef;border:1px solid #f0cecb}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4{color:#d38042}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a{color:#dcb67f}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading{background-color:#e7f0f7;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a{background-color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li{border-right:1px solid #ddd;border-right-color:#c3d9ec;color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content{background-color:#ebf3f9;border:1px solid #c3d9ec}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4{color:#0f6ab4}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a{color:#6fa5d2}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content{border-top:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child{padding-right:0;border-right:none}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover{text-decoration:underline}.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first,.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child{padding-left:0}.swagger-section .swagger-ui-wrap p#colophon{margin:0 15px 40px;padding:10px 0;font-size:.8em;border-top:1px solid #ddd;font-family:Droid Sans,sans-serif;color:#999;font-style:italic}.swagger-section .swagger-ui-wrap p#colophon a{text-decoration:none;color:#547f00}.swagger-section .swagger-ui-wrap h3{color:#000;font-size:1.1em;padding:10px 0}.swagger-section .swagger-ui-wrap .markdown ol,.swagger-section .swagger-ui-wrap .markdown ul{font-family:Droid Sans,sans-serif;margin:5px 0 10px;padding:0 0 0 18px;list-style-type:disc}.swagger-section .swagger-ui-wrap form.form_box{background-color:#ebf3f9;border:1px solid #c3d9ec;padding:10px}.swagger-section .swagger-ui-wrap form.form_box label{color:#0f6ab4!important}.swagger-section .swagger-ui-wrap form.form_box input[type=submit]{display:block;padding:10px}.swagger-section .swagger-ui-wrap form.form_box p.weak{font-size:.8em}.swagger-section .swagger-ui-wrap form.form_box p{font-size:.9em;padding:0 0 15px;color:#7e7b6d}.swagger-section .swagger-ui-wrap form.form_box p a{color:#646257}.swagger-section .swagger-ui-wrap form.form_box p strong{color:#000}.swagger-section .swagger-ui-wrap .operation-status td.markdown>p:last-child{padding-bottom:0}.swagger-section .title{font-style:bold}.swagger-section .secondary_form{display:none}.swagger-section .main_image{display:block;margin-left:auto;margin-right:auto}.swagger-section .oauth_body{margin-left:100px;margin-right:100px}.swagger-section .oauth_submit{text-align:center;display:inline-block}.swagger-section .authorize-wrapper{margin:15px 0 10px}.swagger-section .authorize-wrapper_operation{float:right}.swagger-section .authorize__btn:hover{text-decoration:underline;cursor:pointer}.swagger-section .authorize__btn_operation:hover .authorize-scopes{display:block}.swagger-section .authorize-scopes{position:absolute;margin-top:20px;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;font-size:13px;max-width:300px;line-height:30px;color:#000;padding:5px}.swagger-section .authorize-scopes .authorize__scope{text-decoration:none}.swagger-section .authorize__btn_operation{height:18px;vertical-align:middle;display:inline-block;background:url(../images/explorer_icons.png) no-repeat}.swagger-section .authorize__btn_operation_login{background-position:0 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .authorize__btn_operation_logout{background-position:-30px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section #auth_container{color:#fff;display:inline-block;border:none;padding:5px;width:87px;height:13px}.swagger-section #auth_container .authorize__btn{color:#fff}.swagger-section .auth_container{padding:0 0 10px;margin-bottom:5px;border-bottom:1px solid #ccc;font-size:.9em}.swagger-section .auth_container .auth__title{color:#547f00;font-size:1.2em}.swagger-section .auth_container .basic_auth__label{display:inline-block;width:60px}.swagger-section .auth_container .auth__description{color:#999;margin-bottom:5px}.swagger-section .auth_container .auth__button{margin-top:10px;height:30px}.swagger-section .auth_container .key_auth__field{margin:5px 0}.swagger-section .auth_container .key_auth__label{display:inline-block;width:60px}.swagger-section .api-popup-dialog{position:absolute;display:none}.swagger-section .api-popup-dialog-wrapper{z-index:2;width:500px;background:#fff;padding:20px;border:1px solid #ccc;border-radius:5px;font-size:13px;color:#777;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.swagger-section .api-popup-dialog-shadow{position:fixed;top:0;left:0;width:100%;height:100%;opacity:.2;background-color:gray;z-index:1}.swagger-section .api-popup-dialog .api-popup-title{font-size:24px;padding:10px 0}.swagger-section .api-popup-dialog .error-msg{padding-left:5px;padding-bottom:5px}.swagger-section .api-popup-dialog .api-popup-content{max-height:500px;overflow-y:auto}.swagger-section .api-popup-dialog .api-popup-authbtn,.swagger-section .api-popup-dialog .api-popup-cancel{height:30px}.swagger-section .api-popup-scopes{padding:10px 20px}.swagger-section .api-popup-scopes li{padding:5px 0;line-height:20px}.swagger-section .api-popup-scopes li input{position:relative;top:2px}.swagger-section .api-popup-scopes .api-scope-desc{padding-left:20px;font-style:italic}.swagger-section .api-popup-actions{padding-top:10px}.swagger-section fieldset{padding-bottom:10px;padding-left:20px}.swagger-section .access,.swagger-section .auth{float:right}.swagger-section .api-ic{height:18px;vertical-align:middle;display:inline-block;background:url(../images/explorer_icons.png) no-repeat}.swagger-section .api-ic .api_information_panel{position:relative;margin-top:20px;margin-left:-5px;background:#fff;border:1px solid #ccc;border-radius:5px;display:none;font-size:13px;max-width:300px;line-height:30px;color:#000;padding:5px}.swagger-section .api-ic .api_information_panel p .api-msg-enabled{color:green}.swagger-section .api-ic .api_information_panel p .api-msg-disabled{color:red}.swagger-section .api-ic:hover .api_information_panel{position:absolute;display:block}.swagger-section .ic-info{background-position:0 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .ic-warning{background-position:-60px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .ic-error{background-position:-30px 0;width:18px;margin-top:-6px;margin-left:4px}.swagger-section .ic-off{background-position:-90px 0;width:58px;margin-top:-4px;cursor:pointer}.swagger-section .ic-on{background-position:-160px 0;width:58px;margin-top:-4px;cursor:pointer}.swagger-section #header{background-color:#89bf04;padding:9px 14px 19px;height:23px;min-width:775px}.swagger-section #input_baseUrl{width:400px}.swagger-section #api_selector{display:block;clear:none;float:right}.swagger-section #api_selector .input{display:inline-block;clear:none;margin:0 10px 0 0}.swagger-section #api_selector input{font-size:.9em;padding:3px;margin:0}.swagger-section #input_apiKey{width:200px}.swagger-section #auth_container .authorize__btn,.swagger-section #explore{display:block;text-decoration:none;font-weight:700;padding:6px 8px;font-size:.9em;color:#fff;background-color:#547f00;border-radius:4px}.swagger-section #auth_container .authorize__btn:hover,.swagger-section #explore:hover{background-color:#547f00}.swagger-section #header #logo{font-size:1.5em;font-weight:700;text-decoration:none;color:#fff}.swagger-section #header #logo .logo__img{display:block;float:left;margin-top:2px}.swagger-section #header #logo .logo__title{display:inline-block;padding:5px 0 0 10px}.swagger-section #content_message{margin:10px 15px;font-style:italic;color:#999}.swagger-section #message-bar{min-height:30px;text-align:center;padding-top:10px}.swagger-section .swagger-collapse:before{content:"-"}.swagger-section .swagger-expand:before{content:"+"}.swagger-section .error{outline-color:#c00;background-color:#f2dede} \ No newline at end of file diff --git a/review_repo/src/main/resources/static/swagger/css/style.css b/review_repo/src/main/resources/static/swagger/css/style.css new file mode 100644 index 0000000..52907e4 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/css/style.css @@ -0,0 +1 @@ +.swagger-section #header a#logo{font-size:1.5em;font-weight:700;text-decoration:none;padding:20px 0 20px 40px}#text-head{font-size:80px;font-family:Roboto,sans-serif;color:#fff;float:right;margin-right:20%}.navbar-fixed-top .navbar-brand,.navbar-fixed-top .navbar-nav,.navbar-header{height:auto}.navbar-inverse{background-color:#000;border-color:#000}#navbar-brand{margin-left:20%}.navtext{font-size:10px}.h1,h1{font-size:60px}.navbar-default .navbar-header .navbar-brand{color:#a2dfee}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#393939;font-family:Arvo,serif;font-size:1.5em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#525252;padding-left:0;display:block;clear:none;float:left;font-family:Arvo,serif;font-weight:700}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#0a0a0a}.container1{width:1500px;margin:auto;margin-top:0;background-repeat:no-repeat;background-position:-40px -20px;margin-bottom:210px}.container-inner{width:1200px;margin:auto;background-color:hsla(192,8%,88%,.75);padding-bottom:40px;padding-top:40px;border-radius:15px}.header-content{padding:0;width:1000px}.title1{font-size:80px;font-family:Vollkorn,serif;color:#404040;text-align:center;padding-top:40px;padding-bottom:100px}#icon{margin-top:-18px}.subtext{font-size:25px;font-style:italic;color:#08b;text-align:right;padding-right:250px}.bg-primary{background-color:#00468b}.navbar-default .nav>li>a,.navbar-default .nav>li>a:focus,.navbar-default .nav>li>a:focus:hover,.navbar-default .nav>li>a:hover{color:#08b}.text-faded{font-size:25px;font-family:Vollkorn,serif}.section-heading{font-family:Vollkorn,serif;font-size:45px;padding-bottom:10px}hr{border-color:#00468b;padding-bottom:10px}.description{margin-top:20px;padding-bottom:200px}.description li{font-family:Vollkorn,serif;font-size:25px;color:#525252;margin-left:28%;padding-top:5px}.gap{margin-top:200px}.troubleshootingtext{color:hsla(0,0%,100%,.7);padding-left:30%}.troubleshootingtext li{list-style-type:circle;font-size:25px;padding-bottom:5px}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.block.response_body.json:hover{cursor:pointer}.backdrop{color:blue}#myModal{height:100%}.modal-backdrop{bottom:0;position:fixed}.curl{padding:10px;font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em;max-height:400px;margin-top:5px;overflow-y:auto;background-color:#fcf6db;border:1px solid #e5e0c6;border-radius:4px}.curl_title{font-size:1.1em;margin:0;padding:15px 0 5px;font-family:Open Sans,Helvetica Neue,Arial,sans-serif;font-weight:500;line-height:1.1}.footer{display:none}.swagger-section .swagger-ui-wrap h2{padding:0}h2{margin:0;margin-bottom:5px}.markdown p,.swagger-section .swagger-ui-wrap .code{font-size:15px;font-family:Arvo,serif}.swagger-section .swagger-ui-wrap b{font-family:Arvo,serif}#signin:hover{cursor:pointer}.dropdown-menu{padding:15px}.navbar-right .dropdown-menu{left:0;right:auto}#signinbutton{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}.navbar-default .nav>li .details{color:#000;text-transform:none;font-size:15px;font-weight:400;font-family:Open Sans,sans-serif;font-style:italic;line-height:20px;top:-2px}.navbar-default .nav>li .details:hover{color:#000}#signout{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b} \ No newline at end of file diff --git a/review_repo/src/main/resources/static/swagger/css/typography.css b/review_repo/src/main/resources/static/swagger/css/typography.css new file mode 100644 index 0000000..e69de29 diff --git a/review_repo/src/main/resources/static/swagger/favicon-16x16.png b/review_repo/src/main/resources/static/swagger/favicon-16x16.png new file mode 100644 index 0000000..0f7e13b Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/favicon-16x16.png differ diff --git a/review_repo/src/main/resources/static/swagger/favicon-32x32.png b/review_repo/src/main/resources/static/swagger/favicon-32x32.png new file mode 100644 index 0000000..b0a3352 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/favicon-32x32.png differ diff --git a/review_repo/src/main/resources/static/swagger/fonts/DroidSans-Bold.ttf b/review_repo/src/main/resources/static/swagger/fonts/DroidSans-Bold.ttf new file mode 100644 index 0000000..036c4d1 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/fonts/DroidSans-Bold.ttf differ diff --git a/review_repo/src/main/resources/static/swagger/fonts/DroidSans.ttf b/review_repo/src/main/resources/static/swagger/fonts/DroidSans.ttf new file mode 100644 index 0000000..e517a0c Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/fonts/DroidSans.ttf differ diff --git a/review_repo/src/main/resources/static/swagger/images/collapse.gif b/review_repo/src/main/resources/static/swagger/images/collapse.gif new file mode 100644 index 0000000..8843e8c Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/collapse.gif differ diff --git a/review_repo/src/main/resources/static/swagger/images/expand.gif b/review_repo/src/main/resources/static/swagger/images/expand.gif new file mode 100644 index 0000000..477bf13 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/expand.gif differ diff --git a/review_repo/src/main/resources/static/swagger/images/explorer_icons.png b/review_repo/src/main/resources/static/swagger/images/explorer_icons.png new file mode 100644 index 0000000..be43b27 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/explorer_icons.png differ diff --git a/review_repo/src/main/resources/static/swagger/images/favicon-16x16.png b/review_repo/src/main/resources/static/swagger/images/favicon-16x16.png new file mode 100644 index 0000000..0f7e13b Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/favicon-16x16.png differ diff --git a/review_repo/src/main/resources/static/swagger/images/favicon-32x32.png b/review_repo/src/main/resources/static/swagger/images/favicon-32x32.png new file mode 100644 index 0000000..b0a3352 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/favicon-32x32.png differ diff --git a/review_repo/src/main/resources/static/swagger/images/favicon.ico b/review_repo/src/main/resources/static/swagger/images/favicon.ico new file mode 100644 index 0000000..8b60bcf Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/favicon.ico differ diff --git a/review_repo/src/main/resources/static/swagger/images/logo_small.png b/review_repo/src/main/resources/static/swagger/images/logo_small.png new file mode 100644 index 0000000..ce3908e Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/logo_small.png differ diff --git a/review_repo/src/main/resources/static/swagger/images/pet_store_api.png b/review_repo/src/main/resources/static/swagger/images/pet_store_api.png new file mode 100644 index 0000000..1192ad8 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/pet_store_api.png differ diff --git a/review_repo/src/main/resources/static/swagger/images/throbber.gif b/review_repo/src/main/resources/static/swagger/images/throbber.gif new file mode 100644 index 0000000..0639388 Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/throbber.gif differ diff --git a/review_repo/src/main/resources/static/swagger/images/wordnik_api.png b/review_repo/src/main/resources/static/swagger/images/wordnik_api.png new file mode 100644 index 0000000..dc0ddab Binary files /dev/null and b/review_repo/src/main/resources/static/swagger/images/wordnik_api.png differ diff --git a/review_repo/src/main/resources/static/swagger/index.html b/review_repo/src/main/resources/static/swagger/index.html new file mode 100644 index 0000000..0696781 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/index.html @@ -0,0 +1,107 @@ + + + + + + 接口文档 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     
    +
    + + diff --git a/review_repo/src/main/resources/static/swagger/index.yaml b/review_repo/src/main/resources/static/swagger/index.yaml new file mode 100644 index 0000000..fae9f10 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/index.yaml @@ -0,0 +1,1664 @@ +swagger: '2.0' +info: + description: 教育 + version: 1.0.0 + title: 快速开发平台 + +basePath: /jazz_education + +schemes: + - http + +#认证 +securityDefinitions: + api_key: + type: "apiKey" + name: "token" + in: "header" + +#定义接口数据 +paths: + /captcha.jpg: + get: + tags: + - 用户登录 + summary: 获取验证码 + produces: + - application/octet-stream + parameters: + - name: uuid + description: UUID + in: query + type: string + required: true + /sys/login: + post: + tags: + - 用户登录 + summary: 用户登录 + produces: + - application/json + parameters: + - name: body + description: 管理员对象 + in: body + type: string + schema: + $ref: '#/definitions/LoginForm' + required: true + responses: + '200': + schema: + $ref: '#/definitions/Login' + + /sys/user/list: + get: + tags: + - 管理员管理 + summary: 管理员列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + - name: username + description: 用户名 + in: query + type: string + responses: + '200': + description: 返回管理员列表 + schema: + $ref: '#/definitions/SysUserEntityList' + /sys/user/info: + get: + tags: + - 管理员管理 + summary: 当前管理员信息 + produces: + - application/json + responses: + '200': + description: 返回当前管理员信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + user: + $ref: '#/definitions/SysUserEntity' + /sys/user/info/{userId}: + get: + tags: + - 管理员管理 + summary: 获取管理员信息 + produces: + - application/json + parameters: + - name: userId + description: 用户ID + in: path + type: integer + required: true + responses: + '200': + description: 返回管理员信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + user: + $ref: '#/definitions/SysUserEntity' + /sys/user/password: + post: + tags: + - 管理员管理 + summary: 修改密码 + produces: + - application/json + parameters: + - name: body + description: 管理员对象 + in: body + type: string + schema: + $ref: '#/definitions/PasswordForm' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/user/save: + post: + tags: + - 管理员管理 + summary: 添加管理员 + produces: + - application/json + parameters: + - name: body + description: 管理员对象 + in: body + type: string + schema: + $ref: '#/definitions/SysUserEntityEdit' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/user/update: + post: + tags: + - 管理员管理 + summary: 修改管理员 + produces: + - application/json + parameters: + - name: body + description: 管理员对象 + in: body + type: string + schema: + $ref: '#/definitions/SysUserEntityEdit' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/user/delete: + post: + tags: + - 管理员管理 + summary: 删除管理员 + produces: + - application/json + parameters: + - name: body + description: 用户ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + + /sys/role/list: + get: + tags: + - 角色管理 + summary: 角色列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + - name: roleName + description: 角色名 + in: query + type: string + responses: + '200': + description: 返回角色列表 + schema: + $ref: '#/definitions/SysRoleEntityList' + /sys/role/select: + get: + tags: + - 角色管理 + summary: 当前账号角色列表 + description: 如果是超级管理员,则能查询所有的角色列表 + produces: + - application/json + responses: + '200': + description: 返回角色列表 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/SysRoleEntity' + /sys/role/info/{roleId}: + get: + tags: + - 角色管理 + summary: 获取角色信息 + produces: + - application/json + parameters: + - name: roleId + description: 角色ID + in: path + type: integer + required: true + responses: + '200': + description: 返回角色信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + role: + $ref: '#/definitions/SysRoleEntity' + /sys/role/save: + post: + tags: + - 角色管理 + summary: 添加角色 + produces: + - application/json + parameters: + - name: body + description: 角色对象 + in: body + type: string + schema: + $ref: '#/definitions/SysRoleEntityEdit' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/role/update: + post: + tags: + - 角色管理 + summary: 修改角色 + produces: + - application/json + parameters: + - name: body + description: 角色对象 + in: body + type: string + schema: + $ref: '#/definitions/SysRoleEntityEdit' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/role/delete: + post: + tags: + - 角色管理 + summary: 删除角色 + produces: + - application/json + parameters: + - name: body + description: 角色ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + + /sys/menu/nav: + get: + tags: + - 菜单管理 + summary: 导航菜单列表 + produces: + - application/json + responses: + '200': + description: 返回导航菜单列表 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + menuList: + description: 菜单列表 + type: array + items: + $ref: '#/definitions/SysMenuEntity' + permissions: + description: 权限列表 + type: array + items: + type: string + /sys/menu/list: + get: + tags: + - 菜单管理 + summary: 菜单列表 + produces: + - application/json + responses: + '200': + description: 返回菜单列表 + schema: + type: array + items: + $ref: '#/definitions/SysMenuEntity' + /sys/menu/select: + get: + tags: + - 菜单管理 + summary: 选择菜单 + description: 添加、修改菜单的时候,选择上级菜单接口 + produces: + - application/json + responses: + '200': + description: 返回菜单列表 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + menuList: + description: 菜单列表 + type: array + items: + $ref: '#/definitions/SysMenuEntity' + /sys/menu/info/{menuId}: + get: + tags: + - 菜单管理 + summary: 获取菜单信息 + produces: + - application/json + parameters: + - name: menuId + description: 菜单ID + in: path + type: integer + required: true + responses: + '200': + description: 返回菜单信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + menu: + description: 菜单信息 + $ref: '#/definitions/SysMenuEntity' + /sys/menu/save: + post: + tags: + - 菜单管理 + summary: 添加菜单 + produces: + - application/json + parameters: + - name: body + description: 菜单对象 + in: body + type: string + schema: + $ref: '#/definitions/SysMenuEntityEdit' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/menu/update: + post: + tags: + - 菜单管理 + summary: 修改菜单 + produces: + - application/json + parameters: + - name: body + description: 菜单对象 + in: body + type: string + schema: + $ref: '#/definitions/SysMenuEntityEdit' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/menu/delete/{menuId}: + post: + tags: + - 菜单管理 + summary: 删除菜单 + produces: + - application/json + parameters: + - name: menuId + description: 菜单ID + in: path + type: integer + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + + /sys/log/list: + get: + tags: + - 系统日志 + summary: 日志列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + - name: key + description: 用户名或用户操作 + in: query + type: string + responses: + '200': + description: 返回日志列表 + schema: + $ref: '#/definitions/SysLogEntityList' + + /sys/config/list: + get: + tags: + - 参数管理 + summary: 参数列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + - name: key + description: 参数名 + in: query + type: string + responses: + '200': + description: 返回参数列表 + schema: + $ref: '#/definitions/SysConfigEntityList' + /sys/config/info/{id}: + get: + tags: + - 参数管理 + summary: 获取参数信息 + produces: + - application/json + parameters: + - name: id + description: 参数ID + in: path + type: integer + required: true + responses: + '200': + description: 返回参数信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + config: + description: 返回参数信息 + $ref: '#/definitions/SysConfigEntity' + /sys/config/save: + post: + tags: + - 参数管理 + summary: 添加参数 + produces: + - application/json + parameters: + - name: body + description: 参数对象 + in: body + type: string + schema: + $ref: '#/definitions/SysConfigEntity' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/config/update: + post: + tags: + - 参数管理 + summary: 修改参数 + produces: + - application/json + parameters: + - name: body + description: 参数对象 + in: body + type: string + schema: + $ref: '#/definitions/SysConfigEntity' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/config/delete: + post: + tags: + - 参数管理 + summary: 删除参数 + produces: + - application/json + parameters: + - name: body + description: 参数ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + + /sys/oss/list: + get: + tags: + - 文件服务 + summary: 文件列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + responses: + '200': + description: 返回文件列表 + schema: + $ref: '#/definitions/SysOssEntityList' + /sys/oss/config: + get: + tags: + - 文件服务 + summary: 云存储配置信息 + produces: + - application/json + responses: + '200': + description: 返回云存储配置信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + config: + description: 云存储配置信息 + $ref: '#/definitions/SysCloudStorageEntity' + /sys/oss/saveConfig: + post: + tags: + - 文件服务 + summary: 保存云存储配置信息 + produces: + - application/json + parameters: + - name: body + description: 参数对象 + in: body + type: string + schema: + $ref: '#/definitions/SysCloudStorageEntity' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/oss/upload: + post: + tags: + - 文件服务 + summary: 上传文件 + consumes: + - multipart/form-data + produces: + - application/json + parameters: + - name: file + description: 文件 + in: formData + type: file + required: true + responses: + '200': + description: 返回文件列表 + schema: + $ref: '#/definitions/FileUpload' + /sys/oss/delete: + post: + tags: + - 文件服务 + summary: 删除文件 + produces: + - application/json + parameters: + - name: body + description: 文件ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + + /sys/schedule/list: + get: + tags: + - 定时任务 + summary: 定时任务列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + - name: beanName + description: spring bean名称 + in: query + type: string + responses: + '200': + description: 返回定时任务列表 + schema: + $ref: '#/definitions/ScheduleJobEntityList' + /sys/schedule/info/{jobId}: + get: + tags: + - 定时任务 + summary: 获取定时任务信息 + produces: + - application/json + parameters: + - name: jobId + description: 定时任务ID + in: path + type: integer + required: true + responses: + '200': + description: 返回定时任务信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + schedule: + description: 定时任务信息 + $ref: '#/definitions/ScheduleJobEntity' + /sys/schedule/save: + post: + tags: + - 定时任务 + summary: 添加定时任务 + produces: + - application/json + parameters: + - name: body + description: 定时任务对象 + in: body + type: string + schema: + $ref: '#/definitions/ScheduleJobEntity' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/schedule/update: + post: + tags: + - 定时任务 + summary: 修改定时任务 + produces: + - application/json + parameters: + - name: body + description: 定时任务对象 + in: body + type: string + schema: + $ref: '#/definitions/ScheduleJobEntity' + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/schedule/delete: + post: + tags: + - 定时任务 + summary: 删除定时任务 + produces: + - application/json + parameters: + - name: body + description: 定时任务ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/schedule/run: + post: + tags: + - 定时任务 + summary: 立即执行任务 + produces: + - application/json + parameters: + - name: body + description: 定时任务ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/schedule/pause: + post: + tags: + - 定时任务 + summary: 暂停定时任务 + produces: + - application/json + parameters: + - name: body + description: 定时任务ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + /sys/schedule/resume: + post: + tags: + - 定时任务 + summary: 恢复定时任务 + produces: + - application/json + parameters: + - name: body + description: 定时任务ID列表 + in: body + type: array + items: + type: integer + format: int64 + default: 0 + required: true + responses: + '200': + schema: + $ref: '#/definitions/R' + + /sys/scheduleLog/list: + get: + tags: + - 定时任务 + summary: 定时任务日志列表 + produces: + - application/json + parameters: + - name: page + description: 页码 + in: query + type: integer + required: true + - name: limit + description: 每页条数 + in: query + type: integer + required: true + - name: sidx + description: 排序字段 + in: query + type: string + - name: order + description: 排序方式,如:asc、desc + in: query + type: string + - name: beanName + description: spring bean名称 + in: query + type: string + responses: + '200': + description: 返回定时任务日志列表 + schema: + $ref: '#/definitions/ScheduleJobLogEntityList' + /sys/scheduleLog/info/{logId}: + get: + tags: + - 定时任务 + summary: 获取定时任务日志信息 + produces: + - application/json + parameters: + - name: logId + description: 日志ID + in: path + type: integer + required: true + responses: + '200': + description: 返回定时任务日志信息 + schema: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + schedule: + description: 定时任务日志信息 + $ref: '#/definitions/ScheduleJobLogEntity' + +#定义数据模型 +definitions: + R: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + msg: + description: 失败原因 + type: string + Login: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + token: + description: token + type: string + expire: + description: 过期时长 + type: integer + format: int32 + msg: + description: 失败原因 + type: string + LoginForm: + type: object + properties: + username: + description: 用户名 + type: string + password: + description: 密码 + type: string + captcha: + description: 验证码 + type: string + uuid: + description: UUID + type: string + PasswordForm: + type: object + properties: + password: + description: 原密码 + type: string + newPassword: + description: 新密码 + type: string + SysUserEntity: + type: object + properties: + userId: + description: 用户ID + type: integer + format: int64 + username: + description: 用户名 + type: string + password: + description: 密码 + type: string + email: + description: 邮箱 + type: string + mobile: + description: 手机号 + type: string + status: + description: 状态 0:禁用 1:正常 + type: integer + format: int32 + roleIdList: + description: 角色ID列表 + type: array + items: + type: integer + format: int64 + createUserId: + description: 创建者ID + type: integer + format: int64 + createTime: + description: 创建时间 + type: string + format: date-time + SysUserEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/SysUserEntity' + SysUserEntityEdit: + type: object + properties: + userId: + description: 用户ID + type: integer + format: int64 + username: + description: 用户名 + type: string + password: + description: 密码 + type: string + email: + description: 邮箱 + type: string + mobile: + description: 手机号 + type: string + status: + description: 状态 0:禁用 1:正常 + type: integer + format: int32 + roleIdList: + description: 角色ID列表 + type: array + items: + type: integer + format: int32 + + SysRoleEntity: + type: object + properties: + roleId: + description: 角色ID + type: integer + format: int64 + roleName: + description: 角色名称 + type: string + remark: + description: 备注 + type: string + menuIdList: + description: 菜单ID列表 + type: array + items: + type: integer + format: int64 + createUserId: + description: 创建者ID + type: integer + format: int64 + createTime: + description: 创建时间 + type: string + format: date-time + SysRoleEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/SysRoleEntity' + SysRoleEntityEdit: + type: object + properties: + roleId: + description: 角色ID + type: integer + format: int64 + roleName: + description: 角色名称 + type: string + remark: + description: 备注 + type: string + menuIdList: + description: 菜单ID列表 + type: array + items: + type: integer + format: int64 + + SysMenuEntity: + type: object + properties: + menuId: + description: 菜单ID + type: integer + format: int64 + name: + description: 菜单名称 + type: string + parentId: + description: 父菜单ID,一级菜单为0 + type: integer + format: int64 + parentName: + description: 父菜单名称 + type: string + url: + description: 菜单URL + type: string + perms: + description: 授权标识 + type: string + type: + description: 类型 0:目录 1:菜单 2:按钮 + type: integer + format: int32 + icon: + description: 菜单图标 + type: string + orderNum: + description: 排序 + type: integer + format: int32 + open: + description: 是否展开 true:展开 false:不展开 + type: boolean + format: int32 + SysMenuEntityEdit: + type: object + properties: + menuId: + description: 菜单ID + type: integer + format: int64 + name: + description: 菜单名称 + type: string + parentId: + description: 父菜单ID,一级菜单为0 + type: integer + format: int64 + url: + description: 菜单URL + type: string + perms: + description: 授权标识 + type: string + type: + description: 类型 0:目录 1:菜单 2:按钮 + type: integer + format: int32 + icon: + description: 菜单图标 + type: string + orderNum: + description: 排序 + type: integer + format: int32 + + SysLogEntity: + type: object + properties: + id: + description: 日志ID + type: integer + format: int64 + username: + description: 用户名 + type: string + operation: + description: 用户操作 + type: string + method: + description: 请求方法 + type: string + params: + description: 请求参数 + type: string + time: + description: 执行时长(毫秒) + type: integer + format: int64 + ip: + description: IP地址 + type: string + createTime: + description: 创建时间 + type: string + format: date-time + SysLogEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/SysLogEntity' + + SysConfigEntity: + type: object + properties: + id: + description: 参数ID + type: integer + format: int64 + key: + description: 参数名 + type: string + value: + description: 参数值 + type: string + remark: + description: 备注 + type: string + SysConfigEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/SysConfigEntity' + + SysOssEntity: + type: object + properties: + id: + description: ID + type: integer + format: int64 + url: + description: URL地址 + type: string + createTime: + description: 创建时间 + type: string + format: date-time + SysOssEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/SysOssEntity' + SysCloudStorageEntity: + type: object + properties: + type: + description: 类型 1:七牛 2:阿里云 3:腾讯云 + type: integer + format: int32 + qiniuDomain: + description: 七牛绑定的域名 + type: string + qiniuPrefix: + description: 七牛路径前缀 + type: string + qiniuAccessKey: + description: 七牛ACCESS_KEY + type: string + qiniuSecretKey: + description: 七牛SECRET_KEY + type: string + qiniuBucketName: + description: 七牛存储空间名 + type: string + aliyunDomain: + description: 阿里云绑定的域名 + type: string + aliyunPrefix: + description: 阿里云路径前缀 + type: string + aliyunEndPoint: + description: 阿里云EndPoint + type: string + aliyunAccessKeyId: + description: 阿里云AccessKeyId + type: string + aliyunAccessKeySecret: + description: 阿里云AccessKeySecret + type: string + aliyunBucketName: + description: 阿里云BucketName + type: string + qcloudDomain: + description: 腾讯云绑定的域名 + type: string + qcloudPrefix: + description: 腾讯云路径前缀 + type: string + qcloudAppId: + description: 腾讯云AppId + type: string + qcloudSecretId: + description: 腾讯云SecretId + type: string + qcloudSecretKey: + description: 腾讯云SecretKey + type: string + qcloudBucketName: + description: 腾讯云BucketName + type: string + qcloudRegion: + description: 腾讯云COS所属地区 + type: string + FileUpload: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + url: + description: 文件URL地址 + type: string + msg: + description: 失败原因 + type: string + + ScheduleJobEntity: + type: object + properties: + jobId: + description: 任务ID + type: integer + format: int64 + beanName: + description: spring bean名称 + type: string + methodName: + description: 方法名 + type: string + params: + description: 参数 + type: string + cronExpression: + description: cron表达式 + type: string + status: + description: 任务状态 0:正常 1:暂停 + type: integer + format: int32 + remark: + description: 备注 + type: string + createTime: + description: 创建时间 + type: string + format: date-time + ScheduleJobEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/ScheduleJobEntity' + + ScheduleJobLogEntity: + type: object + properties: + logId: + description: 日志id + type: integer + format: int64 + jobId: + description: 任务id + type: integer + format: int64 + beanName: + description: spring bean名称 + type: string + methodName: + description: 方法名 + type: string + params: + description: 参数 + type: string + status: + description: 任务状态 0:成功 1:失败 + type: integer + format: int32 + error: + description: 失败信息 + type: string + times: + description: 耗时(单位:毫秒) + type: integer + format: int32 + createTime: + description: 创建时间 + type: string + format: date-time + ScheduleJobLogEntityList: + type: object + properties: + code: + description: 状态码 0:成功 非0:失败 + type: integer + format: int32 + page: + type: object + properties: + totalCount: + description: 总记录数 + type: integer + format: int32 + pageSize: + description: 每页记录数 + type: integer + format: int32 + totalPage: + description: 总页数 + type: integer + format: int32 + currPage: + description: 当前页数 + type: integer + format: int32 + list: + type: array + items: + $ref: '#/definitions/ScheduleJobLogEntity' diff --git a/review_repo/src/main/resources/static/swagger/lang/en.js b/review_repo/src/main/resources/static/swagger/lang/en.js new file mode 100644 index 0000000..9183136 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/lang/en.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"Warning: Deprecated", + "Implementation Notes":"Implementation Notes", + "Response Class":"Response Class", + "Status":"Status", + "Parameters":"Parameters", + "Parameter":"Parameter", + "Value":"Value", + "Description":"Description", + "Parameter Type":"Parameter Type", + "Data Type":"Data Type", + "Response Messages":"Response Messages", + "HTTP Status Code":"HTTP Status Code", + "Reason":"Reason", + "Response Model":"Response Model", + "Request URL":"Request URL", + "Response Body":"Response Body", + "Response Code":"Response Code", + "Response Headers":"Response Headers", + "Hide Response":"Hide Response", + "Headers":"Headers", + "Try it out!":"Try it out!", + "Show/Hide":"Show/Hide", + "List Operations":"List Operations", + "Expand Operations":"Expand Operations", + "Raw":"Raw", + "can't parse JSON. Raw result":"can't parse JSON. Raw result", + "Example Value":"Example Value", + "Model Schema":"Model Schema", + "Model":"Model", + "Click to set as parameter value":"Click to set as parameter value", + "apply":"apply", + "Username":"Username", + "Password":"Password", + "Terms of service":"Terms of service", + "Created by":"Created by", + "See more at":"See more at", + "Contact the developer":"Contact the developer", + "api version":"api version", + "Response Content Type":"Response Content Type", + "Parameter content type:":"Parameter content type:", + "fetching resource":"fetching resource", + "fetching resource list":"fetching resource list", + "Explore":"Explore", + "Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.", + "Please specify the protocol for":"Please specify the protocol for", + "Can't read swagger JSON from":"Can't read swagger JSON from", + "Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI", + "Unable to read api":"Unable to read api", + "from path":"from path", + "server returned":"server returned" +}); diff --git a/review_repo/src/main/resources/static/swagger/lang/translator.js b/review_repo/src/main/resources/static/swagger/lang/translator.js new file mode 100644 index 0000000..ffb879f --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/lang/translator.js @@ -0,0 +1,39 @@ +'use strict'; + +/** + * Translator for documentation pages. + * + * To enable translation you should include one of language-files in your index.html + * after . + * For example - + * + * If you wish to translate some new texts you should do two things: + * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too. + * 2. Mark that text it templates this way New Phrase or . + * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate. + * + */ +window.SwaggerTranslator = { + + _words:[], + + translate: function(sel) { + var $this = this; + sel = sel || '[data-sw-translate]'; + + $(sel).each(function() { + $(this).html($this._tryTranslate($(this).html())); + + $(this).val($this._tryTranslate($(this).val())); + $(this).attr('title', $this._tryTranslate($(this).attr('title'))); + }); + }, + + _tryTranslate: function(word) { + return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; + }, + + learn: function(wordsMap) { + this._words = wordsMap; + } +}; diff --git a/review_repo/src/main/resources/static/swagger/lang/zh-cn.js b/review_repo/src/main/resources/static/swagger/lang/zh-cn.js new file mode 100644 index 0000000..c7f55b4 --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/lang/zh-cn.js @@ -0,0 +1,56 @@ +'use strict'; + +/* jshint quotmark: double */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated":"警告:已过时", + "Implementation Notes":"接口备注", + "Response Class":"响应类", + "Status":"状态", + "Parameters":"参数", + "Parameter":"参数", + "Value":"值", + "Description":"描述", + "Parameter Type":"参数类型", + "Data Type":"数据类型", + "Response Messages":"响应消息", + "HTTP Status Code":"HTTP状态码", + "Reason":"原因", + "Response Model":"响应模型", + "Request URL":"请求URL", + "Response Body":"响应体", + "Response Code":"响应码", + "Response Headers":"响应头", + "Hide Response":"隐藏响应", + "Headers":"头", + "Try it out!":"试一下!", + "Show/Hide":"显示/隐藏", + "List Operations":"显示操作", + "Expand Operations":"展开操作", + "Raw":"原始", + "can't parse JSON. Raw result":"无法解析JSON. 原始结果", + "Example Value":"示例", + "Click to set as parameter value":"点击设置参数", + "Model Schema":"模型架构", + "Model":"模型", + "apply":"应用", + "Username":"用户名", + "Password":"密码", + "Terms of service":"服务条款", + "Created by":"创建者", + "See more at":"查看更多:", + "Contact the developer":"联系开发者", + "api version":"api版本", + "Response Content Type":"响应类型", + "Parameter content type:":"参数类型:", + "fetching resource":"正在获取资源", + "fetching resource list":"正在获取资源列表", + "Explore":"浏览", + "Show Swagger Petstore Example Apis":"显示 Swagger Petstore 示例 Apis", + "Can't read from server. It may not have the appropriate access-control-origin settings.":"无法从服务器读取。可能没有正确设置access-control-origin。", + "Please specify the protocol for":"请指定协议:", + "Can't read swagger JSON from":"无法读取swagger JSON于", + "Finished Loading Resource Information. Rendering Swagger UI":"已加载资源信息。正在渲染Swagger UI", + "Unable to read api":"无法读取api", + "from path":"从路径", + "server returned":"服务器返回" +}); diff --git a/review_repo/src/main/resources/static/swagger/lib/backbone-min.js b/review_repo/src/main/resources/static/swagger/lib/backbone-min.js new file mode 100644 index 0000000..8eff02e --- /dev/null +++ b/review_repo/src/main/resources/static/swagger/lib/backbone-min.js @@ -0,0 +1 @@ +!function(t,e){if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(i,n,s){t.Backbone=e(t,s,i,n)});else if("undefined"!=typeof exports){var i=require("underscore");e(t,exports,i)}else t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}(this,function(t,e,i,n){var s=t.Backbone,r=[],a=(r.push,r.slice);r.splice;e.VERSION="1.1.2",e.$=n,e.noConflict=function(){return t.Backbone=s,this},e.emulateHTTP=!1,e.emulateJSON=!1;var o=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var n=this._events[t]||(this._events[t]=[]);return n.push({callback:e,context:i,ctx:i||this}),this},once:function(t,e,n){if(!c(this,"once",t,[e,n])||!e)return this;var s=this,r=i.once(function(){s.off(t,r),e.apply(this,arguments)});return r._callback=e,this.on(t,r,n)},off:function(t,e,n){var s,r,a,o,h,u,l,d;if(!this._events||!c(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(o=t?[t]:i.keys(this._events),h=0,u=o.length;h").attr(t);this.setElement(n,!1)}}}),e.sync=function(t,n,s){var r=E[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:r,dataType:"json"};if(s.url||(a.url=i.result(n,"url")||j()),null!=s.data||!n||"create"!==t&&"update"!==t&&"patch"!==t||(a.contentType="application/json",a.data=JSON.stringify(s.attrs||n.toJSON(s))),s.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),s.emulateHTTP&&("PUT"===r||"DELETE"===r||"PATCH"===r)){a.type="POST",s.emulateJSON&&(a.data._method=r);var o=s.beforeSend;s.beforeSend=function(t){if(t.setRequestHeader("X-HTTP-Method-Override",r),o)return o.apply(this,arguments)}}"GET"===a.type||s.emulateJSON||(a.processData=!1),"PATCH"===a.type&&x&&(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var h=s.xhr=e.ajax(i.extend(a,s));return n.trigger("request",n,h,s),h};var x=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),E={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var k=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},T=/\((.*?)\)/g,$=/(\(\?)?:\w+/g,S=/\*\w+/g,H=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(k.prototype,o,{initialize:function(){},route:function(t,n,s){i.isRegExp(t)||(t=this._routeToRegExp(t)),i.isFunction(n)&&(s=n,n=""),s||(s=this[n]);var r=this;return e.history.route(t,function(i){var a=r._extractParameters(t,i);r.execute(s,a),r.trigger.apply(r,["route:"+n].concat(a)),r.trigger("route",n,a),e.history.trigger("route",r,n,a)}),this},execute:function(t,e){t&&t.apply(this,e)},navigate:function(t,i){return e.history.navigate(t,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var t,e=i.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(H,"\\$&").replace(T,"(?:$1)?").replace($,function(t,e){return e?t:"([^/?]+)"}).replace(S,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var n=t.exec(e).slice(1);return i.map(n,function(t,e){return e===n.length-1?t||null:t?decodeURIComponent(t):null})}});var A=e.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},I=/^[#\/]|\s+$/g,N=/^\/+|\/+$/g,R=/msie [\w.]+/,O=/\/$/,P=/#.*$/;A.started=!1,i.extend(A.prototype,o,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(O,"");t.indexOf(i)||(t=t.slice(i.length))}else t=this.getHash();return t.replace(I,"")},start:function(t){if(A.started)throw new Error("Backbone.history has already been started");A.started=!0,this.options=i.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var n=this.getFragment(),s=document.documentMode,r=R.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);if(this.root=("/"+this.root+"/").replace(N,"/"),r&&this._wantsHashChange){var a=e.$('