From f0b4883ed70af38890bd48e0d95ca63852b49104 Mon Sep 17 00:00:00 2001 From: houjishuang <46269784@qq.com> Date: Sat, 7 Jun 2025 15:27:04 +0800 Subject: [PATCH] gongyingshangxinxi denglu --- .../ebtp/login/common/CaptchaGenerator.java | 150 ++++++++ .../mall/ebtp/login/common/Constants.java | 186 +++++++++ .../mall/ebtp/login/common/MdConstants.java | 28 ++ .../mall/ebtp/login/common/RSA.java | 356 ++++++++++++++++++ .../login/controller/EshopMenuController.java | 42 +++ .../login/controller/LoginController.java | 60 +++ .../mall/ebtp/login/dao/BaseUserMapper.java | 21 ++ .../ebtp/login/dao/BaseUserTokenMapper.java | 10 + .../mall/ebtp/login/dao/EshopMenuMapper.java | 15 + .../ebtp/login/dao/mapper/BaseUserMapper.xml | 153 ++++++++ .../login/dao/mapper/BaseUserTokenMapper.xml | 21 ++ .../ebtp/login/dao/mapper/EshopMenuMapper.xml | 59 +++ .../mall/ebtp/login/entity/BaseOrgn.java | 127 +++++++ .../mall/ebtp/login/entity/BaseOrgnR.java | 30 ++ .../mall/ebtp/login/entity/BaseRole.java | 47 +++ .../mall/ebtp/login/entity/BaseRoleOrgn.java | 36 ++ .../ebtp/login/entity/BaseRoleOrgnVo.java | 39 ++ .../mall/ebtp/login/entity/BaseSelf.java | 41 ++ .../mall/ebtp/login/entity/BaseTelIdcard.java | 49 +++ .../mall/ebtp/login/entity/BaseUser.java | 115 ++++++ .../ebtp/login/entity/BaseUserSelect.java | 41 ++ .../ebtp/login/entity/BaseUserSelectVo.java | 84 +++++ .../mall/ebtp/login/entity/BaseUserToken.java | 54 +++ .../ebtp/login/entity/BuffeedImageVo.java | 12 + .../ebtp/login/entity/EshopMenuConverter.java | 29 ++ .../entity/EshopMenuConverterChildren.java | 14 + .../mall/ebtp/login/entity/EshopMenuPO.java | 79 ++++ .../ebtp/login/entity/EshopMenuQuery.java | 61 +++ .../ebtp/login/service/BaseUserService.java | 28 ++ .../login/service/BaseUserTokenService.java | 17 + .../ebtp/login/service/EshopMenuService.java | 27 ++ .../service/impl/BaseUserServiceImpl.java | 307 +++++++++++++++ .../impl/BaseUserTokenServiceImpl.java | 45 +++ .../service/impl/EshopMenuServiceImpl.java | 41 ++ .../mall/ebtp/login/utils/HttpsUtils.java | 129 +++++++ .../mall/ebtp/login/vo/LoginUserVo.java | 14 + .../base/dao/SupplierContactMapper.java | 14 + .../ebtp/supplier/base/dto/ContactDTO.java | 13 + .../supplier/base/entity/SupplierContact.java | 31 ++ .../supplier/base/vo/ContactSearchVO.java | 4 + .../base/dao/mapper/SupplierContactMapper.xml | 48 +++ 41 files changed, 2677 insertions(+) create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/common/CaptchaGenerator.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/common/Constants.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/common/MdConstants.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/common/RSA.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/controller/EshopMenuController.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/controller/LoginController.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserMapper.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserTokenMapper.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/dao/EshopMenuMapper.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserMapper.xml create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserTokenMapper.xml create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/EshopMenuMapper.xml create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgn.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgnR.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRole.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgn.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgnVo.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseSelf.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseTelIdcard.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUser.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelect.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelectVo.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserToken.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/BuffeedImageVo.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverter.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverterChildren.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuPO.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuQuery.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserService.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserTokenService.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/service/EshopMenuService.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserServiceImpl.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserTokenServiceImpl.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/EshopMenuServiceImpl.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/utils/HttpsUtils.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/login/vo/LoginUserVo.java create mode 100644 src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dao/SupplierContactMapper.java create mode 100644 src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dto/ContactDTO.java create mode 100644 src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/entity/SupplierContact.java create mode 100644 src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/vo/ContactSearchVO.java create mode 100644 src/main/resources/com/chinaunicom/zyhy/ebtp/supplier/base/dao/mapper/SupplierContactMapper.xml diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/common/CaptchaGenerator.java b/src/main/java/com/chinaunicom/mall/ebtp/login/common/CaptchaGenerator.java new file mode 100644 index 0000000..6a097a7 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/common/CaptchaGenerator.java @@ -0,0 +1,150 @@ +package com.chinaunicom.mall.ebtp.login.common; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; +import com.chinaunicom.mall.ebtp.login.entity.BuffeedImageVo; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.Base64; +import java.util.Random; + +@Slf4j +@Service +public class CaptchaGenerator { + private int width = 120; // 验证码图片的宽度 + private int height = 40; // 验证码图片的高度 + private int length = 4; // 验证码的长度 + private String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; // 可选的字符集合 + + @Value("${login.captcha.time_limit}") + private Integer timeLimit; + @Value("${login.captcha.publicKey}") + private String publicKey; + @Value("${login.captcha.privateKey}") + private String privateKey; + + public BuffeedImageVo generateCaptcha() { + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D g = image.createGraphics(); + + // 设置背景颜色 + g.setColor(Color.WHITE); + Font font = new Font("Arial", Font.BOLD,32); + g.setFont(font); + g.fillRect(0, 0, width, height); + + // 生成随机验证码 + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + int x = (width - 20) / length; + int y = height - 10; + for (int i = 0; i < length; i++) { + int index = random.nextInt(chars.length()); + String captchaChar = String.valueOf(chars.charAt(index)); + sb.append(captchaChar); + g.setColor(new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255))); + g.drawString(captchaChar, x * i + 10, y); + } + + // 生成干扰线 + for (int i = 0; i < 40; i++) { + int x1 = random.nextInt(width); + int y1 = random.nextInt(height); + int x2 = random.nextInt(width); + int y2 = random.nextInt(height); + g.setColor(new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255))); + g.drawLine(x1, y1, x2, y2); + } + + g.dispose(); + BuffeedImageVo vo = new BuffeedImageVo(); + + vo.setCode(sb.toString()); + vo.setImage(image); + return vo; + } + + /** + * 获取图形验证码 + * @return + */ + public BuffeedImageVo getCaptcha(){ + BuffeedImageVo vo = this.generateCaptcha(); + String creteTime = LocalDateTimeUtil.format(LocalDateTime.now().plusMinutes(timeLimit), "yyyy-MM-dd HH:mm:ss"); + String code = encoded(vo.getCode()+"_"+creteTime); + vo.setCode(code); + return vo; + } + + /** + * 校验验证码 + * @return + */ + public Boolean checkCaptcha(String value, String captch){ + + try{ + String cap = this.encoded(captch); + String[] caps = cap.split("_"); + String time = caps[1]; + LocalDateTime ltime = LocalDateTimeUtil.parse(time,"yyyy-MM-dd HH:mm:ss"); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("验证码无效", LocalDateTime.now().isAfter(ltime)); + + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("验证码无效",!value.equals(caps[0])); + + }catch (Exception e){ + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("验证码无效",true); + } + return true; + } + + private String encoded(String value){ + String val = ""; + System.out.println("\r加密前文字:\r\n" + value); + try { + byte[] data = value.getBytes(); + byte[] encodedData = RSA.encryptByPublicKey(data, publicKey); + val = RSA.encryptBASE64(encodedData); + System.out.println("加密后文字:\r\n" + val); + }catch (Exception e){ + log.error("加密失败 异常!",e); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("加密失败",true); + } + return val; + } + + private String decrypt(String value){ + String val = ""; + System.out.println("\r解密前文字:\r\n" + value); + try { + byte[] encodedData = RSA.decryptBASE64(value); + byte[] decodedData = RSA.decryptByPrivateKey(encodedData, privateKey); + val = new String(decodedData); + System.out.println("解密后文字:\r\n" + val); + }catch (Exception e){ + log.error("解密失败 异常!",e); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("解密失败",true); + } + return val; + } + + public static void main(String[] args) throws IOException { + CaptchaGenerator captchaGenerator = new CaptchaGenerator(); + BuffeedImageVo vo = captchaGenerator.generateCaptcha(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(vo.getImage(), "png", baos); + byte[] imageData = baos.toByteArray(); + + System.out.println("验证码图片:"+ Base64.getEncoder().encodeToString(imageData)); + // 展示验证码图像或保存为文件 + System.out.println("验证码:" + vo.getCode()); + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/common/Constants.java b/src/main/java/com/chinaunicom/mall/ebtp/login/common/Constants.java new file mode 100644 index 0000000..4d40001 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/common/Constants.java @@ -0,0 +1,186 @@ +package com.chinaunicom.mall.ebtp.login.common; + + +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Slf4j +public class Constants { + + public static final String ANNO_MODE_VO_B = "BizAnnoVoBtable"; + public static final String ANNO_MODE_VO_M = "BizAnnoVoMtable"; + + public static final String EBTP_TENANT_BY = "EBTP"; + + public static final String DELETE_FLAG_NORMAL = "normal"; + public static final String DELETE_FLAG_DELETED = "deleted"; + //有效 + public static final Integer TENANTS_STATE_VALID = 1; + //失效 + public static final Integer TENANTS_STATE_INVALID = 0; + //有效 + public static final Integer ANNO_STATE_VALID = 1; + //失效 + public static final Integer ANNO_STATE_INVALID = 0; + //发布 release + public static final Integer NOTICE_STATE_RELEASE = 1; + //未发布 revoke + public static final Integer NOTICE_STATE_NO_RELEASE = 0; + //年 + public static final Integer TENANTS_TERM = 2; + //分钟 + public static final Integer TOKEN_TIME_OUT = 2; + //公告 + public static final String DICT_TYPE_ANNO = "anno"; + //采购方式 + public static final String DICT_TYPE_MODE = "procurement_mode"; + //采购类型 + public static final String DICT_TYPE_TYPE = "procurement_type"; + //省分 + public static final String DICT_TYPE_PROVINCES = "provinces"; + + //省分 - 其他 + public static final String DICT_TYPE_PROVINCES_10000 = "10000"; + + //配置参数 + public static final String BIZ_CONFIG_TYPE_CONFIG = "1"; + //过滤配置参数 + public static final String BIZ_CONFIG_TYPE_CHECK_ANNO = "2"; + //登录信息禁止配置参数 + public static final String BIZ_CONFIG_TYPE_LOGIN_ANNO = "3"; + + //是否置顶 是 + public static final String TOP_STATE_Y = "1"; + //是否置顶 否 + public static final String TOP_STATE_N = "0"; + + //是否显示置顶 是 + public static final String SHOW_TOP_STATE_Y = "1"; + //是否显示置顶 否 + public static final String SHOW_TOP_STATE_N = "0"; + + public static Map> dictMap = new HashMap<>(); + + public static void setDict(Map> map) { + dictMap = map; + } + + public static String getDict(String id, String moduleType) { + Map map = dictMap.get(moduleType); + if(map!=null){ + return map.get(id); + } + return null; + } + + + //专家库管理员 + public static final String ROLE_CODE_E_D_ADMIN = "e_d_admin"; + //专家 + public static final String ROLE_CODE_EXPERT = "expert"; + //管理员 + public static final String ROLE_CODE_ADMIN = "sys_admin"; + + /** + * 通过文件名判断并获取OSS服务文件上传时文件的contentType + * @param fileName 文件名 + * @return 文件的contentType + */ + public static String getContentType(String fileExtension){ + //文件的后缀名 + if("bmp".equalsIgnoreCase(fileExtension)) { + return "image/bmp"; + } + if("gif".equalsIgnoreCase(fileExtension)) { + return "image/gif"; + } + if("jpeg".equalsIgnoreCase(fileExtension) || "jpg".equalsIgnoreCase(fileExtension) || "png".equalsIgnoreCase(fileExtension) ) { + return "image/jpeg"; + } + if("html".equalsIgnoreCase(fileExtension)) { + return "text/html"; + } + if("txt".equalsIgnoreCase(fileExtension)) { + return "text/plain"; + } + if("vsd".equalsIgnoreCase(fileExtension)) { + return "application/vnd.visio"; + } + if("ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) { + return "application/vnd.ms-powerpoint"; + } + if("doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) { + return "application/msword"; + } + if ("xls".equalsIgnoreCase(fileExtension) || "xlsx".equalsIgnoreCase(fileExtension)) { + return "application/msexcel"; + } + if ("csv".equalsIgnoreCase(fileExtension)) { + return "application/csv"; + } + if("xml".equalsIgnoreCase(fileExtension)) { + return "text/xml"; + } + if("mp4".equalsIgnoreCase(fileExtension)) { + return "video/mp4"; + } + if("avi".equalsIgnoreCase(fileExtension)) { + return "video/x-msvideo"; + } + if("mov".equalsIgnoreCase(fileExtension)) { + return "video/quicktime"; + } + if("mpeg".equalsIgnoreCase(fileExtension) || "mpg".equalsIgnoreCase(fileExtension)) { + return "video/mpeg"; + } + if("wm".equalsIgnoreCase(fileExtension)) { + return "video/x-ms-wmv"; + } + if("flv".equalsIgnoreCase(fileExtension)) { + return "video/x-flv"; + } + if("mkv".equalsIgnoreCase(fileExtension)) { + return "video/x-matroska"; + } + //默认返回类型 + return "video/x-msvideo"; + } + + + //账号类型 专家 + public static final String USER_TYPE_EXPERT = "3"; + //专家管理员 + public static final String USER_TYPE_EXPERT_ADMIN = "2"; + //业务经理 + public static final String USER_TYPE_BUSINESS_MANAGER = "4"; + //游客 + public static final String USER_TYPE_TOURIST = "99"; + + + //账号类型 专家 + public static final String ORGN_STAUTS_OK = "2";//审批通过 + public static final String ORGN_STAUTS_WAIT = "1";//待审批 + public static final String ORGN_STAUTS_NOT = "0";//未提交 + public static final String ORGN_STAUTS_NO = "-1";//审批未通过 + + public static final String ORGN_SUBMIT_TYPE_I = "1";//入库 + public static final String ORGN_SUBMIT_TYPE_U = "2";//变更 + + public static final String ORGN_UPDATE_TYPE_ING = "0";//变更中 + public static final String ORGN_UPDATE_TYPE_OVER = "1";//已变更 + + public static final String USER_STATUS_FREEZE = "0";//冻结 + public static final String USER_STATUS_LIVE = "1";//正常 + + public static final Integer USER_TOKEN_STATUS_E = 1;//正常 + + + public static final String ORGN_USER_TYPE_1 = "1";//招标人 + public static final String ORGN_USER_TYPE_2 = "2";//代理机构 + public static final String ORGN_USER_TYPE_3 = "3";//评标专家单位 +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/common/MdConstants.java b/src/main/java/com/chinaunicom/mall/ebtp/login/common/MdConstants.java new file mode 100644 index 0000000..52fcd45 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/common/MdConstants.java @@ -0,0 +1,28 @@ +package com.chinaunicom.mall.ebtp.login.common; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class MdConstants { + + + public static String getSha256(String str) { + try { + // 初始化MessageDigest并指定MD5算法 + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.update(str.getBytes()); + // 将字节转换为十六进制字符串 + return new BigInteger(1, md.digest()).toString(16); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + public static void main(String[] args) { + + String originalString = "Hello, World!"; + System.out.println("Original String: " + originalString); + System.out.println("SHA-256 Hash: " + MdConstants.getSha256(originalString)); + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/common/RSA.java b/src/main/java/com/chinaunicom/mall/ebtp/login/common/RSA.java new file mode 100644 index 0000000..75becf7 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/common/RSA.java @@ -0,0 +1,356 @@ +package com.chinaunicom.mall.ebtp.login.common; + +import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; + +import javax.crypto.Cipher; +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.Base64; +import java.util.HashMap; +import java.util.Map; + +public class RSA { + + public static final String KEY_ALGORITHM = "RSA"; + public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; + + private static final String PUBLIC_KEY = "RSAPublicKey"; + private static final String PRIVATE_KEY = "RSAPrivateKey"; + + /** + * 初始化密钥 + * + * @return + * @throws Exception + */ + public static Map initKey() throws Exception { + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); + keyPairGen.initialize(1024); + KeyPair keyPair = keyPairGen.generateKeyPair(); + + // 公钥 + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); +// logger.info("------" + publicKey); + // 私钥 + RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); +// logger.info("------" + publicKey); + + Map keyMap = new HashMap (2); + + keyMap.put(PUBLIC_KEY, publicKey); + keyMap.put(PRIVATE_KEY, privateKey); + return keyMap; + } + + /** + * 取得私钥 + * + * @param keyMap + * @return + * @throws Exception + */ + public static String getPrivateKey(Map keyMap) + throws Exception { + Key key = (Key) keyMap.get(PRIVATE_KEY); + return encryptBASE64(key.getEncoded()); + } + + /** + * 取得公钥 + * + * @param keyMap + * @return + * @throws Exception + */ + public static String getPublicKey(Map keyMap) + throws Exception { + Key key = (Key) keyMap.get(PUBLIC_KEY); + return encryptBASE64(key.getEncoded()); + } + + + /** + * 解密
+ * 用私钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptByPrivateKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得私钥 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 对数据解密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + + return cipher.doFinal(data); + } + /** + * 解密
+ * 用私钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static String decryptByPrivateKeyString(byte[] data, String key) + throws Exception { + return new String(decryptByPrivateKey(data, key)); + } + + + /** + * 解密
+ * 用公钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptByPublicKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得公钥 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicKey = keyFactory.generatePublic(x509KeySpec); + + // 对数据解密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, publicKey); + + return cipher.doFinal(data); + } + + /** + * 加密
+ * 用公钥加密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] encryptByPublicKey(byte[] data, String key) + throws Exception { + // 对公钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得公钥 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicKey = keyFactory.generatePublic(x509KeySpec); + + // 对数据加密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + + return cipher.doFinal(data); + } + + /** + * 加密
+ * 用私钥加密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] encryptByPrivateKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得私钥 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 对数据加密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + + return cipher.doFinal(data); + } + + /** + * 用私钥对信息生成数字签名 + * + * @param data + * 加密数据 + * @param privateKey + * 私钥 + * + * @return + * @throws Exception + */ + public static String sign(byte[] data, String privateKey) throws Exception { + // 解密由base64编码的私钥 + byte[] keyBytes = decryptBASE64(privateKey); + + // 构造PKCS8EncodedKeySpec对象 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + + // KEY_ALGORITHM 指定的加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + + // 取私钥匙对象 + PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 用私钥对信息生成数字签名 + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initSign(priKey); + signature.update(data); + + return encryptBASE64(signature.sign()); + } + + /** + * 校验数字签名 + * + * @param data + * 加密数据 + * @param publicKey + * 公钥 + * @param sign + * 数字签名 + * + * @return 校验成功返回true 失败返回false + * @throws Exception + * + */ + public static boolean verify(byte[] data, String publicKey, String sign) + throws Exception { + + // 解密由base64编码的公钥 + byte[] keyBytes = decryptBASE64(publicKey); + + // 构造X509EncodedKeySpec对象 + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + + // KEY_ALGORITHM 指定的加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + + // 取公钥匙对象 + PublicKey pubKey = keyFactory.generatePublic(keySpec); + + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initVerify(pubKey); + signature.update(data); + + // 验证签名是否正常 + return signature.verify(decryptBASE64(sign)); + } + + public static byte[] decryptBASE64(String key) throws Exception { + return Base64.getDecoder().decode(key); + } + + public static String encryptBASE64(byte[] key) throws Exception { + return Base64.getEncoder().encodeToString(key); + } + + public static String encrypt(String value,String publicKey){ + try { + String v = encryptBASE64(RSA.encryptByPublicKey(value.getBytes(), publicKey)); + return v; + }catch (Exception e){ + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("加密异常", true); + } + return ""; + } + public static String decrypt(String value,String privateKey){ + try { + byte[] decodedData = decryptByPrivateKey(decryptBASE64(value), privateKey); + String target = new String(decodedData); + return target; + }catch (Exception e){ + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("解密异常", true); + } + return ""; + } + public static void main(String[] args) { + Map keyMap; + try { + keyMap = initKey(); +// Map map = initKey(); +// System.out.println(map); + //取得公钥和么私钥 + //keyMap = initKey(); + //String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgkWYQFjlRrCsQQBNZj6uo8KEQamePmxaC6O4JI5SoELnXPlTCJIlQTG1Xzn/ajqjDV4/5ZmZAH+auST4j9L5qH8qnoxT1AN+yhUY6hMV9qxF00e1gBc81mYJO2nwwaQjRsGEoq86e9dP1zX5kOk8vMZN6/g508a1K2IWNwpGp0wIDAQAB"; + //String publicKey = getPublicKey(keyMap); + //#生产 + String publicKey ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCHzL+U09epkBAnn2V4HCADX9gQxpW4iQ3ckM0YMX5CRe9SSzbbRItYMnOsIjogj39gXm7cYJIgE91wQgNJINkD65D2Tm+7vYgLMyw87YBlTONxQ484RW7o5Ofqz72HEXMyfvdpLIJ5lTheeqHmpL20vNkq+CkuHxhVPlYoVl/1uwIDAQAB"; + System.out.println("字符类型公钥:" + publicKey); + + //String privateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKCRZhAWOVGsKxBAE1mPq6jwoRBqZ4+bFoLo7gkjlKgQudc+VMIkiVBMbVfOf9qOqMNXj/lmZkAf5q5JPiP0vmofyqejFPUA37KFRjqExX2rEXTR7WAFzzWZgk7afDBpCNGwYSirzp710/XNfmQ6Ty8xk3r+DnTxrUrYhY3CkanTAgMBAAECgYA8WMkqLKAYUQPSVLKxC20xzlZKbCNF9rzMMK0d5DB/xeGCwxtp5/9vnXnO8X5d7xYAbM1gp5qwaQzy3fYr31UcxHiFTcZMgvN6z32FNBEkejCLaKIFZjaMBn36dStdzpAP+OOclwpXDGpGQO0UKLKshAfl5dsS+fq+nHpOugz52QJBAPUCG9Xzy5TrMiqL9n1TLe1qR+ALfELZHFheevIkyShJtcqlte8u640H0CHDXF9lniisMFn4xChqkxiTUsees58CQQCnxYDP+JfmqORO4Cx2DLCCqOpaOkuxdZo8eSh80s3zbmtdqoMpeYZglVNLuSYKNul8WWF3qeGqcnLULDE6P31NAkEAtSLt+WvYoyyPVi1L+rO4TMI6iUV0hOeGsT6InuTbY1G7eSqyKzcBJq8UDSIl9NFn8KH8zUfBni/MuGqS1Mpb+QJATiPTBwpF1Yy8KXCHxMPMQk7iN/wG3TRlDd1wWhLlEYhQQWP1iw+q4rkp/o7RhNhmjyAiIVXiYTzE9sVOeE6x0QJBAJYmBmOKfxw3rzpjDU+e9I6w0AbpiBzlnviEToZfnDwVH9mjF++H/wDRTDqozIiAE2aN/wqXwqhoWGgVWMlp9Xc="; + //String privateKey = getPrivateKey(keyMap); + //生产 + String privateKey="MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIfMv5TT16mQECefZXgcIANf2BDGlbiJDdyQzRgxfkJF71JLNttEi1gyc6wiOiCPf2BebtxgkiAT3XBCA0kg2QPrkPZOb7u9iAszLDztgGVM43FDjzhFbujk5+rPvYcRczJ+92ksgnmVOF56oeakvbS82Sr4KS4fGFU+VihWX/W7AgMBAAECgYAjblVR9E+havf8Dod/5f6oQrpx7g4kPoYCVTldpZQmoG6Hjx456VFd6pPphmiaFDaMozbTgtK9UdGFt4N58fsMvHG1vSZ5jH6jXW+xGsCpiHp24s6kXlRDPnX1AstezrIcXa+37CJua80/DUXMRysJcByW3HnGmwjKM21EqiyMUQJBAMCgZN/4I5bnUc/gsOwl0Vunp8jtXoMa/dDFyIE7SCNQlkjfTTkzTrQRaHXeDRKBlzLUB0TNMv6gbH4xxAuGY7kCQQC0ejrDRz2O17O+ETlqQ3jubxMLq2ZfhUGWwgJQ5gXT0PgM5Bauv7NygHaxKmmN0EAqk1NTDV0ao3VJOvuLUIcTAkBfJpvNurAx2aAjFHWwoNmy8bVC3mYiUxHvr9NkatkugJ9L7eoiiEKnVjYIiyBf9N2wQOY6STaYarxM9d5GZyMZAkBS8UWmT0xMJHe3pyTS4FVohuWi3E+9IHnHNjxoP354HTaSfhSqlPF8cuuZeltuUEHdDz4hEigywOJ7GD9YhFa/AkBjxKsb4qfJeaz+zxcFHekWaFhgdvpx2/bov9y/wP/HEZo8NRsa1I0wVBiWhSRltYrQU7jMHafnrhiqQUW3BKhm"; + System.out.println("字符类型私钥:" + privateKey); + String s = RSA.encrypt("331081198909263032",publicKey); + System.out.println(s); + + //String s = "nRpkxT2XTYQvQl/xIqgVuIg3d1ezs/QuKZGm2UxAVJiwHN8F3E6jKr6/Ujt1ZODdlt9mPh7+WUepm/7OdbkPiDzoDufFBcscfVzRKpgG7yj0VEhqv4HGTxc5PX3dFKWRGIW4+x02StDezlTRDbhRGn9qNRZhJXTMsHITekM1+YY="; + //s = URLDecoder.decode(s,"utf-8"); + String v = RSA.decrypt(s,privateKey); + System.out.println(v); +// System.out.println("公钥加密——私钥解密---------------"); +// System.out.println(""); +// String source = "9527001"; +// System.out.println("\r加密前文字:\r\n" + source); +// byte[] data = source.getBytes(); +// byte[] encodedData = encryptByPublicKey(data, publicKey); +// System.out.println("加密后文字:\r\n" + encryptBASE64(encodedData)); +// +// byte[] decodedData = decryptByPrivateKey(encodedData, privateKey); +// String target = new String(decodedData); +// System.out.println("解密后文字: \r\n" + target); + +// System.out.println(v); + +// String s1 = RSA.encrypt("Eshop@2022",publicKey); +// System.out.println(s1); +// String s2 = RSA.encrypt("Eshop@2021",publicKey); +// System.out.println(s2); + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * String转私钥PrivateKey + * + * @param key + * @return + * @throws Exception + */ + public static PrivateKey getPrivateKey(String key) throws Exception { + byte[] keyBytes; + keyBytes = org.apache.commons.codec.binary.Base64.decodeBase64(key); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(keySpec); + return privateKey; + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/controller/EshopMenuController.java b/src/main/java/com/chinaunicom/mall/ebtp/login/controller/EshopMenuController.java new file mode 100644 index 0000000..3bd86b0 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/controller/EshopMenuController.java @@ -0,0 +1,42 @@ +package com.chinaunicom.mall.ebtp.login.controller; + + +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuConverter; +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuQuery; +import com.chinaunicom.mall.ebtp.login.service.EshopMenuService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 菜单权限表 前端控制器 + * + * @author wangwj + * @since 2020-12-08 + */ +@Api(tags = "菜单权限管理") +@RestController +@RequestMapping("/v1.0/menu") +public class EshopMenuController{ + + @Autowired + private EshopMenuService eshopMenuService; + + /** + * 根据角色查询顶级权限 + * @param body + * @return BasePageResponse + * @author chentao + * @date 2021-1-13 + * @update [序号][日期YYYY-MM-DD] [更改人姓名][变更描述] + */ + @ApiOperation(value = "根据角色查询顶级权限", notes = "根据角色查询顶级权限") + @PostMapping("/findTopMenuList") + public List findTopMenuList(@RequestBody EshopMenuQuery body) { + return this.eshopMenuService.findTopMenuList(body); + } + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/controller/LoginController.java b/src/main/java/com/chinaunicom/mall/ebtp/login/controller/LoginController.java new file mode 100644 index 0000000..f8bc66d --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/controller/LoginController.java @@ -0,0 +1,60 @@ +package com.chinaunicom.mall.ebtp.login.controller; + + +import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser; +import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; +import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; +import com.chinaunicom.mall.ebtp.login.common.CaptchaGenerator; +import com.chinaunicom.mall.ebtp.login.entity.BaseSelf; +import com.chinaunicom.mall.ebtp.login.service.BaseUserService; + +import com.chinaunicom.mall.ebtp.login.vo.LoginUserVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Slf4j +@RestController +@Api(tags = "登录") +@RequestMapping("/v1/login") +public class LoginController { + + @Resource + private BaseUserService iBaseUserService; + @Resource + private CaptchaGenerator captchaGenerator; + + /** + * 获取图形验证码 + * @return + */ + @ApiOperation("获取图形验证码") + @GetMapping("/getCaptcha") + public BaseResponse getCaptcha(){ + return BaseResponse.success(captchaGenerator.getCaptcha()); + } + /** + * 账号 密码 图形验证码 + * @param vo + * @return + */ + @ApiOperation("账号登录") + @PostMapping("/accountLogin") + public BaseResponse idcardLogin(HttpServletResponse response,@RequestBody LoginUserVo vo) { + if(true||captchaGenerator.checkCaptcha(vo.getIdentifying(),vo.getEncryptValue())){ + BaseSelf self = iBaseUserService.idcardLogin(vo.getAccount(), vo.getPassword()); + this.iBaseUserService.setCookie(response,"mall3_token",self.getToken()); + return BaseResponse.success(self); + }else{ + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("验证码无效",true); + return BaseResponse.success(null); + } + } + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserMapper.java new file mode 100644 index 0000000..66156ff --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserMapper.java @@ -0,0 +1,21 @@ +package com.chinaunicom.mall.ebtp.login.dao; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.AuthorityEntity; +import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper; +import com.chinaunicom.mall.ebtp.login.entity.*; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface BaseUserMapper extends IBaseMapper { + public IPage selectOrgnUser(IPage page, @Param("vo") BaseUserSelect vo); + public BaseUserSelectVo getUserById(@Param("id") String id, @Param("orgnId") String orgnId); + public List getUserByObject(@Param("vo") BaseUserSelectVo vo); + + public List selectRoleByUserId(@Param("userId") String userId); + public List selectOrgnByUserId(@Param("userId") String userId); +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserTokenMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserTokenMapper.java new file mode 100644 index 0000000..d2e1500 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/BaseUserTokenMapper.java @@ -0,0 +1,10 @@ +package com.chinaunicom.mall.ebtp.login.dao; + + +import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper; +import com.chinaunicom.mall.ebtp.login.entity.BaseUserToken; +import org.springframework.stereotype.Repository; + +@Repository +public interface BaseUserTokenMapper extends IBaseMapper { +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/dao/EshopMenuMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/EshopMenuMapper.java new file mode 100644 index 0000000..00aef72 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/EshopMenuMapper.java @@ -0,0 +1,15 @@ +package com.chinaunicom.mall.ebtp.login.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuConverter; +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuPO; +import org.apache.ibatis.annotations.Param; +import org.mapstruct.Mapper; + +import java.util.List; + +@Mapper +public interface EshopMenuMapper extends BaseMapper { + + List findTopMenuList(@Param("roleId") String roleId); +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserMapper.xml new file mode 100644 index 0000000..a805531 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserTokenMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserTokenMapper.xml new file mode 100644 index 0000000..1bb5ae4 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/BaseUserTokenMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + update base_user_token + set + delete_flag="1" + where ID=#{id } + + \ No newline at end of file diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/EshopMenuMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/EshopMenuMapper.xml new file mode 100644 index 0000000..32e88d4 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/dao/mapper/EshopMenuMapper.xml @@ -0,0 +1,59 @@ + + + + + + + sp.menu_id, + sp.menu_name, + sp.parent_id, + sp.menu_, + sp.menu_order, + sp.menu_url, + sp.componet, + sp.menu_frame, + sp.menu_type, + sp.menu_visible, + sp.menu_status, + sp.menu_perms, + sp.menu_icon, + sp.menu_scope, + sp.menu_ou, + sp.menu_auth, + sp.tenant_id + + + + + + diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgn.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgn.java new file mode 100644 index 0000000..035a2e1 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgn.java @@ -0,0 +1,127 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** +* 实体类 BaseOrgn-组织机构信息 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@TableName(value = "base_orgn", autoResultMap = true) +@ApiModel(value = "BaseOrgn对象", description = "组织机构信息") +public class BaseOrgn implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "索引id") + private String id; + + @ApiModelProperty(value = "父id.表内关联") + private String pid; + + @ApiModelProperty(value = "系统编号") + private String code; + + @ApiModelProperty(value = "组织机构名称.如'软件研发部'.是组织树的节点名称") + private String name; + + @ApiModelProperty(value = "组织结构全程.如'产业互联网中心软件研发部'.是选项时的节点名称") + private String fullname; + + @ApiModelProperty(value = "注册地址-三级地址 -分割") + private String registerAddress; + + @ApiModelProperty(value = "详细地址") + private String registerAddress2; + + @ApiModelProperty(value = "企业地址-三级地址 -分割") + private String enterpriseAddress; + + @ApiModelProperty(value = "企业地址") + private String enterpriseAddress2; + + @ApiModelProperty(value = "用户类型 1、招标人,2、代理机构,3、评标专家单位") + private String userType; + + @ApiModelProperty(value = "企业类型 1、国有 2 私营 3合资 4独资 5全民所有制 6集体所有制 8股份制 9有限责任") + private String orgnType; + + @ApiModelProperty(value = "注册资金") + private String registeredCapital; + + @ApiModelProperty(value = "邮编") + private String zipCode; + + @ApiModelProperty(value = "成立时间") + private String foundingTime; + + @ApiModelProperty(value = "联系人") + private String contacts; + + @ApiModelProperty(value = "联系电话") + private String tel; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "传真") + private String fax; + + @ApiModelProperty(value = "统一社会信用代码") + private String uscc; + + @ApiModelProperty(value = "统一社会信用代码证") + private String usccFileId; + + @ApiModelProperty(value = "营业执照") + private String businessLicenseFileId; + + @ApiModelProperty(value = "其他资质证明") + private String otherFileId; + + @ApiModelProperty(value = "法人信息 json [{\"name\":\"张三\",“duty”:\"董事长\",\"title\":\"高级工程师\",\"idcard\":\"223323232\"}]") + private String legalRepresentative; + + @ApiModelProperty(value = "负责人信息 json [{\"name\":\"张三\",“duty”:\"董事长\",\"title\":\"高级工程师\",\"idcard\":\"223323232\"}]") + private String head; + + @ApiModelProperty(value = "审批状态 0 未提交 1 待审批 2审批通过 -1 审批未通过") + private String status; + + @ApiModelProperty(value = "申请类型 1、入库 2、变更") + private String submitType; + + @ApiModelProperty(value = "未通过原因") + private String reason; + + @ApiModelProperty(value = "版本号") + private String version; + + @ApiModelProperty(value = "创建人") + private String createby; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "") + private LocalDateTime createtime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "") + private LocalDateTime updatetime; + + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgnR.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgnR.java new file mode 100644 index 0000000..3b21ac7 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseOrgnR.java @@ -0,0 +1,30 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** +* 实体类 BaseOrgn-组织机构信息 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@ApiModel(value = "BaseOrgn对象", description = "机构列表") +public class BaseOrgnR implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "索引id") + private String orgnId; + + @ApiModelProperty(value = "组织机构名称.如'软件研发部'.是组织树的节点名称") + private String orgnName; + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRole.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRole.java new file mode 100644 index 0000000..46901a5 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRole.java @@ -0,0 +1,47 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 功能模块bean + * + * @author zyx + */ +@Data +@Accessors(chain = true) +@ApiModel +@TableName(value = "maint_base_role", autoResultMap = true) +public class BaseRole implements Serializable { + + private static final Long serialVersionUID = 1L; + + /** + * 姓名 + */ + @ApiModelProperty(value = "角色") + private String role; + + /** + * 账号 + */ + @ApiModelProperty(value = "备注") + private String remarks; + + /** + * role_id + */ + @ApiModelProperty(value = "role_id") + private String roleId; + + /** + * 账号 + */ + @ApiModelProperty(value = "状态,0-默认") + private int status; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgn.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgn.java new file mode 100644 index 0000000..7a0e5c7 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgn.java @@ -0,0 +1,36 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** +* 实体类 BaseRole-角色表 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@ApiModel(value = "BaseRole对象", description = "显示角色表") +public class BaseRoleOrgn implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "") + private String roleId; + + @ApiModelProperty(value = "") + private String roleName; + + @ApiModelProperty(value = "") + private String roleCode; + + @ApiModelProperty(value = "机构列表") + private List baseOrgnList; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgnVo.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgnVo.java new file mode 100644 index 0000000..6c7af10 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseRoleOrgnVo.java @@ -0,0 +1,39 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** +* 实体类 BaseRole-角色表 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@ApiModel(value = "BaseRole对象", description = "显示角色表") +public class BaseRoleOrgnVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "") + private String roleId; + + @ApiModelProperty(value = "") + private String roleName; + + @ApiModelProperty(value = "") + private String roleCode; + + @ApiModelProperty(value = "") + private String orgnId; + + @ApiModelProperty(value = "") + private String orgnName; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseSelf.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseSelf.java new file mode 100644 index 0000000..69d4d39 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseSelf.java @@ -0,0 +1,41 @@ +package com.chinaunicom.mall.ebtp.login.entity; + + +import lombok.Data; + +import java.util.List; + +/** + * @author ligen + * + */ +@Data +public class BaseSelf { + + /** + * token + */ + private String token; + /** + * previoustoken + */ + private String previoustoken; + + /** + * 登陆ip + */ + private String ip; + + /** + * + */ + private BaseUser user; //user + /** + * 所属机构 + */ + private BaseOrgn orgn; + /** + * 所属机构 + */ + private List orgnList; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseTelIdcard.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseTelIdcard.java new file mode 100644 index 0000000..0f2853e --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseTelIdcard.java @@ -0,0 +1,49 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** +* 实体类 BaseTelIdcard- +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@TableName(value = "base_tel_idcard", autoResultMap = true) +@ApiModel(value = "BaseTelIdcard对象", description = "") +public class BaseTelIdcard implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "") + private String id; + + @ApiModelProperty(value = "手机号") + private String tel; + + @ApiModelProperty(value = "验证码") + private String idcard; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "有效时间") + private LocalDateTime effectiveTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "发送时间") + private LocalDateTime sendTime; + + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUser.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUser.java new file mode 100644 index 0000000..d37289a --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUser.java @@ -0,0 +1,115 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** +* 实体类 BaseUser-用户基本信息表 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@TableName(value = "base_user", autoResultMap = true) +@ApiModel(value = "BaseUser对象", description = "用户基本信息表") +public class BaseUser implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "") + private String id; + + @ApiModelProperty(value = "账号用户名") + private String account; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "RSA") + private String rsa; + + @ApiModelProperty(value = "HR编号") + private String code; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "") + private String abbr; + + @ApiModelProperty(value = "性别") + private String sex; + + @ApiModelProperty(value = "证件类型") + private String idType; + + @ApiModelProperty(value = "身份证号") + private String idcard; + + @ApiModelProperty(value = "电话号码") + private String phone; + + @ApiModelProperty(value = "邮箱地址") + private String email; + + @ApiModelProperty(value = "地址") + private String address; + + @ApiModelProperty(value = "使能") + private String active; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "来源:1联通内部员工 2合作方账号/招标代理") + private String sourceType; + @ApiModelProperty(value = "联通邮箱") + private String unicomEmail; + + @ApiModelProperty(value = "合作方账号") + private String cuecpAccount; + + @ApiModelProperty(value = "状态 0冻结 1在用") + private String status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "") + private LocalDateTime createtime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "") + private LocalDateTime updatetime; + /** + * 所属机构 + */ + @TableField(exist = false) + private BaseOrgn orgn; + + /** + * 角色 + */ + @TableField(exist = false) + private List roleOrgnList; + + /** + * 权限 + */ + @TableField(exist = false) + private String roleId; + @ApiModelProperty("割接状态;0-割接数据,1-新数据") + private Integer cutoverStatus; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelect.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelect.java new file mode 100644 index 0000000..e90108b --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelect.java @@ -0,0 +1,41 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** +* 实体类 BaseUser-用户基本信息表 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +public class BaseUserSelect implements Serializable { + + private static final long serialVersionUID = 1L; + + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "机构id") + private String orgnId; + + @ApiModelProperty(value = "角色 4、业务经理 3、专家 2、专家管理员") + private String type; + + @ApiModelProperty("当前页") + @NotNull + @Min(0) + private Integer pageNo; + + @ApiModelProperty("每页显示条数") + @NotNull + @Min(0) + private Integer pageSize; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelectVo.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelectVo.java new file mode 100644 index 0000000..82d9475 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserSelectVo.java @@ -0,0 +1,84 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** +* 实体类 BaseUser-用户基本信息表 +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@ApiModel(value = "BaseUser对象", description = "用户基本信息表") +public class BaseUserSelectVo { + + @ApiModelProperty(value = "") + private String id; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "证件类型") + private String idType; + + @ApiModelProperty(value = "身份证号") + private String idcard; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "RSA") + private String rsa; + + @ApiModelProperty(value = "电话号码") + private String phone; + + @ApiModelProperty(value = "角色") + private String roleId; + + @ApiModelProperty(value = "角色") + private String roleName; + + @ApiModelProperty(value = "所属机构名称") + private String orgnName; + + @ApiModelProperty(value = "角色类型") + private String type; + + @ApiModelProperty(value = "状态 0冻结 1在用") + private String status; + + @ApiModelProperty(value = "来源:1联通内部员工 2合作方账号/招标代理") + private String sourceType; + + @ApiModelProperty(value = "联通邮箱") + private String unicomEmail; + + @ApiModelProperty(value = "合作方账号") + private String cuecpAccount; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "") + private LocalDateTime updatetime; + + + @ApiModelProperty("当前页") + @NotNull + @Min(0) + private Integer pageNo; + + @ApiModelProperty("每页显示条数") + @NotNull + @Min(0) + private Integer pageSize; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserToken.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserToken.java new file mode 100644 index 0000000..d245310 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BaseUserToken.java @@ -0,0 +1,54 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** +* 实体类 BaseUserToken- +* +* @author yss +*/ +@Data +@Accessors(chain = true) +@TableName(value = "base_user_token", autoResultMap = true) +@ApiModel(value = "BaseUserToken对象", description = "") +public class BaseUserToken implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId + @ApiModelProperty(value = "") + private String id; + + @ApiModelProperty(value = "") + private String userId; + + @ApiModelProperty(value = "") + private String token; + + @ApiModelProperty(value = "1 生效/0 失效") + private Integer state; + + private String userObject; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "有效时间") + private LocalDateTime validTime; + + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BuffeedImageVo.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BuffeedImageVo.java new file mode 100644 index 0000000..95cd4ab --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/BuffeedImageVo.java @@ -0,0 +1,12 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import lombok.Data; + +import java.awt.image.BufferedImage; + +@Data +public class BuffeedImageVo { + + private String code; + private BufferedImage image; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverter.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverter.java new file mode 100644 index 0000000..0b82edf --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverter.java @@ -0,0 +1,29 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class EshopMenuConverter { + private static final long serialVersionUID = 1L; + @ApiModelProperty("主键") + private String menuId; + @ApiModelProperty("路由地址") + private String path; + @ApiModelProperty("菜单名称") + private String name; + @ApiModelProperty("菜单图标") + private String icon; + @ApiModelProperty("系统标识") + private String menuScope; + @ApiModelProperty("地市等级标识") + private String menuOu; + @ApiModelProperty("是否顶级标识:0 是,1 否") + private Integer isTop; + @ApiModelProperty("菜单图标") + private List children; + @ApiModelProperty("feign调用成功或失败的标识 true:为feign调用成功 down:feign调用失败") + private String feignFlag; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverterChildren.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverterChildren.java new file mode 100644 index 0000000..1cdc4f1 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuConverterChildren.java @@ -0,0 +1,14 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class EshopMenuConverterChildren { + @ApiModelProperty("路由地址") + private String path; + @ApiModelProperty("菜单名称") + private String name; + @ApiModelProperty("外链标识(N-非外链、Y-外链,S-3.0内部外链)") + private String frame; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuPO.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuPO.java new file mode 100644 index 0000000..6d19806 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuPO.java @@ -0,0 +1,79 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 菜单权限表 + *

+ * + * @author zhqbin + * @since 2025-04-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eshop_menu") +@ApiModel(value="EshopMenuPO对象", description="菜单权限表") +public class EshopMenuPO extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "menu_id") + private String menuId; + + @ApiModelProperty(value = "菜单名称") + private String menuName; + + @ApiModelProperty(value = "父菜单ID") + private String parentId; + + @ApiModelProperty(value = "显示顺序") + private Integer menuOrder; + + @ApiModelProperty(value = "路由地址") + private String menuUrl; + + @ApiModelProperty(value = "组件地址") + private String componet; + + @ApiModelProperty(value = "是否为外链(Y-是 N-否)") + private String menuFrame; + + @ApiModelProperty(value = "菜单类型(menu-菜单 folder-目录 operation-操作)") + private String menuType; + + @ApiModelProperty(value = "显示状态(show-显示 hide-隐藏)") + private String menuVisible; + + @ApiModelProperty(value = "菜单状态(valid-正常 invalid-停用)") + private String menuStatus; + + @ApiModelProperty(value = "权限标识") + private String menuPerms; + + @ApiModelProperty(value = "菜单图标") + private String menuIcon; + + @ApiModelProperty(value = "系统标识") + private String menuScope; + + @ApiModelProperty(value = "地市等级标识") + private String menuOu; + + @ApiModelProperty(value = "是否可授权(Y-是 N-否)") + private String menuAuth; + + @ApiModelProperty(value = "是否悬浮(Y-是 N-否)") + private String menuSuspension; + + @ApiModelProperty(value = "是否默认展示标识 (Y-是 N-否)") + private String menuDefault; + +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuQuery.java b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuQuery.java new file mode 100644 index 0000000..7f2cd26 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/entity/EshopMenuQuery.java @@ -0,0 +1,61 @@ +package com.chinaunicom.mall.ebtp.login.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +@Data +public class EshopMenuQuery { + @ApiModelProperty("角色ID") + private String roleId; + @ApiModelProperty("主键") + private String menuId; + @ApiModelProperty("菜单名称") + private String menuName; + @ApiModelProperty("父菜单ID") + private String parentId; + @ApiModelProperty("显示顺序") + private Integer menuOrder; + @ApiModelProperty("路由地址") + private String menuUrl; + @ApiModelProperty("组件地址") + private String componet; + @ApiModelProperty("是否为外链(Y-是 N-否)") + private String menuFrame; + @ApiModelProperty("菜单类型(menu-菜单 folder-目录 operation-操作)") + private String menuType; + @ApiModelProperty("显示状态(show-显示 hide-隐藏)") + private String menuVisible; + @ApiModelProperty("菜单状态(valid-正常 invalid-停用)") + private String menuStatus; + @ApiModelProperty("权限标识") + private String menuPerms; + @ApiModelProperty("菜单图标") + private String menuIcon; + @ApiModelProperty("菜单范围") + private String menuScope; + @ApiModelProperty("地市等级标识") + private String menuOu; + @ApiModelProperty("菜单id集合") + private List menuIdList; + @ApiModelProperty("角色ID集合") + private List roleIdList; + @ApiModelProperty("集团、省(市)角色标识 0 集团, 1 省(市)") + private String classFlag; + @ApiModelProperty("角色ID集合 key为角色id value为集团、省(市)标识") + private List> roleMap; + @ApiModelProperty("是否可授权(Y-是 N-否)") + private String menuAuth; + @ApiModelProperty("是否悬浮(Y-是 N-否)") + private String menuSuspension; + @ApiModelProperty("角色范围") + private String roleScope; + @ApiModelProperty("中心编码") + private String centerCode; + @ApiModelProperty("操作标识(add-新增 edit-修改)") + private String operationType; + @ApiModelProperty("是否默认展示标识 (Y-是 N-否)") + private String menuDefault; +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserService.java b/src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserService.java new file mode 100644 index 0000000..3ba711e --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserService.java @@ -0,0 +1,28 @@ +package com.chinaunicom.mall.ebtp.login.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.SecurityEntity; +import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser; +import com.chinaunicom.mall.ebtp.common.base.service.IBaseService; +import com.chinaunicom.mall.ebtp.login.entity.BaseSelf; +import com.chinaunicom.mall.ebtp.login.entity.BaseUser; +import com.chinaunicom.mall.ebtp.login.entity.BaseUserSelect; +import com.chinaunicom.mall.ebtp.login.entity.BaseUserSelectVo; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 对数据表 base_user 操作的 service + * @author yss + * + */ +public interface BaseUserService extends IBaseService { + + BaseSelf idcardLogin(String account, String password); + String getUserHost(); + BaseSelf getRequestUser(); + void setCookie(HttpServletResponse response, String name, String value); + + SecurityEntity bdCheckToken(String token); +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserTokenService.java b/src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserTokenService.java new file mode 100644 index 0000000..df1a0cb --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/service/BaseUserTokenService.java @@ -0,0 +1,17 @@ +package com.chinaunicom.mall.ebtp.login.service; + + +import com.chinaunicom.mall.ebtp.common.base.service.IBaseService; +import com.chinaunicom.mall.ebtp.login.entity.BaseUserToken; + +/** + * 对数据表 base_user_token 操作的 service + * @author yss + * + */ +public interface BaseUserTokenService extends IBaseService { + + + boolean refreshToken(BaseUserToken baseUserToken); + boolean saveToken(String id, String userId, String token); +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/service/EshopMenuService.java b/src/main/java/com/chinaunicom/mall/ebtp/login/service/EshopMenuService.java new file mode 100644 index 0000000..5a33d9e --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/service/EshopMenuService.java @@ -0,0 +1,27 @@ +package com.chinaunicom.mall.ebtp.login.service; + + +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuConverter; +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuQuery; + +import java.util.List; + +/** + *

+ * 菜单权限表 服务类 + *

+ * + * @author wangwj + * @since 2020-12-08 + */ +public interface EshopMenuService { + /** + * 根据角色查询顶级权限 + * @param body + * @return BasePageResponse + * @author chentao + * @date 2021-1-13 + * @update [序号][日期YYYY-MM-DD] [更改人姓名][变更描述] + */ + List findTopMenuList(EshopMenuQuery body); +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserServiceImpl.java new file mode 100644 index 0000000..320fb47 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserServiceImpl.java @@ -0,0 +1,307 @@ +package com.chinaunicom.mall.ebtp.login.service.impl; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.AuthorityEntity; +import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.SecurityEntity; +import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser; +import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService; +import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl; +import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; +import com.chinaunicom.mall.ebtp.login.common.Constants; +import com.chinaunicom.mall.ebtp.login.common.RSA; +import com.chinaunicom.mall.ebtp.login.dao.BaseUserMapper; +import com.chinaunicom.mall.ebtp.login.entity.*; +import com.chinaunicom.mall.ebtp.login.service.BaseUserService; +import com.chinaunicom.mall.ebtp.login.service.BaseUserTokenService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.crypto.BadPaddingException; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * 对数据表 base_user 操作的 serviceImpl + * @author yss + * + */ +@Slf4j +@Service +public class BaseUserServiceImpl extends BaseServiceImpl implements BaseUserService { + + @Autowired + private BaseUserMapper baseUserMapper; + + @Value("${login.password.privateKey}") + private String privateKey; + @Value("${login.password.publickey}") + private String publickey; + @Value("${login.token.time_limit}") + private String valid_time_limit; + @Resource + private IBaseCacheUserService iBaseCacheUserService; + @Resource + private BaseUserTokenService baseUserTokenService; + + @Autowired(required = false) + @Qualifier("cacheRedisTemplate") + private RedisTemplate redisTemplate; + + + @Override + public BaseSelf idcardLogin(String account, String password) { + try { + + List userList = this.list(new LambdaQueryWrapper().eq(BaseUser::getAccount, account).eq(BaseUser::getStatus,Constants.USER_STATUS_LIVE)); + if (userList == null||userList.size()==0) { + throw new RuntimeException("无效用户!"); + } + BaseUser user = userList.get(0); + + if(Constants.USER_STATUS_FREEZE.equals(user.getStatus())){ + throw new RuntimeException("账号已冻结!"); + } + + byte[] decode = RSA.decryptByPrivateKey(RSA.decryptBASE64(password), privateKey); + + String pw = new String(decode); + System.out.println("公钥解密结果:" + pw); + + if (!this.encode(pw).equals(user.getPassword())) { + throw new RuntimeException("认证密码错误!"); + } + + return userLogin(user); + }catch (BadPaddingException e){ + log.error("RSA解密异常",e); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("认证密码错误",true); + }catch (Exception e){ + log.error("登录异常",e); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName(e.getMessage(),true); + } + + return null; + } + + private BaseSelf userLogin(BaseUser user) { + BaseSelf self = new BaseSelf(); + String token = getToken(user.getId()); + user.setPassword("****************************"); + self.setUser(user); + String ip = getUserHost(); + self.setIp(ip); + self.setToken(token); + + return self; + } + + private String getToken(String userId){ + + List tokenList = baseUserTokenService.list((new LambdaQueryWrapper().eq(BaseUserToken::getUserId,userId) + .gt(BaseUserToken::getValidTime, LocalDateTime.now()).eq(BaseUserToken::getState,Constants.USER_TOKEN_STATUS_E).orderByDesc(BaseUserToken::getValidTime))); + String token = UUID.randomUUID().toString(); + BaseUserToken tokenObj = new BaseUserToken(); + if(tokenList!=null&&tokenList.size()>0){ + tokenObj = tokenList.get(0); + token = tokenObj.getToken(); + }else{ + tokenObj.setUserId(userId); + tokenObj.setToken(token); + tokenObj.setState(Constants.USER_TOKEN_STATUS_E); + tokenObj.setCreateTime(LocalDateTime.now()); + } + SecurityEntity securityEntity = getUserObjectByUserId(userId); + + tokenObj.setUserObject(JSONObject.toJSONString(securityEntity)); + baseUserTokenService.refreshToken(tokenObj); + return token; + } + + @Override + public void setCookie(HttpServletResponse response,String name, String value) { + Cookie cookie = new Cookie(name, value); + cookie.setPath("/"); + cookie.setMaxAge(-1); + response.addCookie(cookie); + } + + public String encode(String str) { + // 生成一个MD5加密计算摘要 + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + // 计算md5函数 + md.update(str.getBytes()); + // digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符 + // BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值 + return new BigInteger(1, md.digest()).toString(16); + } catch (NoSuchAlgorithmException e) { + + } + return ""; + } + + @Override + public String getUserHost() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) + .getRequest(); + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; + } + + @Override + public BaseSelf getRequestUser() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + + BaseSelf self = new BaseSelf(); + try { + String token = request.getHeader("Authorization-exper"); + token = token.replaceAll("Bearer ", ""); + + CommonExceptionEnum.LOGIN_EXPIRATION.customValidName("无认证信息","".equals(token)); + if(redisTemplate.hasKey(token)){ + self=(BaseSelf)redisTemplate.opsForValue().get(token); + redisTemplate.expire(token,15, TimeUnit.MINUTES); + }else{ + BaseCacheUser user=iBaseCacheUserService.getCacheUser(); + CommonExceptionEnum.LOGIN_EXPIRATION.customValidName("账号不存在",user==null || StringUtils.isBlank(user.getUserId())); + List baseUserList = this.list((new LambdaQueryWrapper().eq(BaseUser::getAccount,user.getUserId()))); + if(baseUserList!=null&&baseUserList.size()>0){ + self = userLogin(baseUserList.get(0)); + self.setToken(token); + redisTemplate.opsForValue().getAndSet(token,self); + redisTemplate.expire(token,15, TimeUnit.MINUTES); + } + } + }catch (Exception e){ + log.error("用户账号异常:{}",e); + CommonExceptionEnum.LOGIN_EXPIRATION.customValidName("用户账号异常:请重新登陆!",true); + } + return self; + } + + public SecurityEntity getUserObjectByUserId(String userId){ + + SecurityEntity securityEntity = new SecurityEntity(); + + BaseUser baseUser = this.baseUserMapper.selectById(userId); + securityEntity.setUserid(baseUser.getAccount()); + securityEntity.setStaffId(baseUser.getAccount()); + securityEntity.setUsername(baseUser.getName()); + securityEntity.setStaffName(baseUser.getName()); + + List roleOrgnList = new ArrayList<>(); + List roleOrgnVoList = this.baseUserMapper.selectOrgnByUserId(baseUser.getId()); + roleOrgnVoList.forEach(ro->{ + BaseRoleOrgn baseRoleOrgn = new BaseRoleOrgn(); + BeanUtils.copyProperties(ro,baseRoleOrgn); + roleOrgnList.add(baseRoleOrgn); + }); + + List droleOrgnList = roleOrgnList.stream().distinct().collect(Collectors.toList()); + + List list = new ArrayList<>(); + List authorityList = new ArrayList<>(); + + droleOrgnList.forEach(droleOrgn->{ + List ro2List = roleOrgnVoList.stream().filter(ro2->ro2.getRoleId().equals(droleOrgn.getRoleId())).distinct().collect(Collectors.toList()); + List baseOrgnRList = new ArrayList<>(); + BaseRoleOrgnVo orgnVo = ro2List.get(0); + securityEntity.setOu(orgnVo.getOrgnId()); + securityEntity.setOuName(orgnVo.getOrgnName()); + securityEntity.setPartnerId(orgnVo.getOrgnId()); + securityEntity.setPartnerName(orgnVo.getOrgnName()); + + ro2List.forEach(ro3->{ + BaseOrgnR baseOrgnR = new BaseOrgnR(); + BeanUtils.copyProperties(ro3,baseOrgnR); + baseOrgnRList.add(baseOrgnR); + }); + droleOrgn.setBaseOrgnList(baseOrgnRList); + list.add(droleOrgn); + + AuthorityEntity authorityEntity = new AuthorityEntity(); + BeanUtils.copyProperties(droleOrgn,authorityEntity); + authorityEntity.setRoleScope("EBTP"); + authorityList.add(authorityEntity); + }); + + securityEntity.setAuthorityList(authorityList); + // securityEntity.setRoleOrgnList(list); + return securityEntity; + } + + /** + * 本地token换取用户信息 + * @param token + * @return + */ + @Override + public SecurityEntity bdCheckToken(String token){ + List tokenList = baseUserTokenService.list((new LambdaQueryWrapper().eq(BaseUserToken::getToken,token) + .gt(BaseUserToken::getValidTime, LocalDateTime.now()).eq(BaseUserToken::getState,Constants.USER_TOKEN_STATUS_E).orderByDesc(BaseUserToken::getValidTime))); + CommonExceptionEnum.LOGIN_EXPIRATION.assertListNotNullByName("",tokenList); + BaseUserToken userToken = tokenList.get(0); + CommonExceptionEnum.LOGIN_EXPIRATION.assertStringNotNullByKey("",tokenList.get(0).getUserObject()); + SecurityEntity securityEntity = JSON.parseObject(userToken.getUserObject(), SecurityEntity.class); + userToken.setValidTime(LocalDateTime.now().plusMinutes(Long.valueOf(valid_time_limit))); + + this.baseUserTokenService.saveOrUpdate(userToken); + + return securityEntity; + } + + public static void main(String args[]) throws Exception { +// String rsa = "ObMojRm4G31O91lJDyV7rT7fmkJ0x/tMz+t2gZa1M5RtZm6cTiaAT6eblAQzjuMbNNU6DoD/YloITzn2jnQH4g2nMj1Y8TXdSEK/q8QSoLb8QVb26SuMt1xuv1hklU0yzkqCtGW7GnRArMMlgQjh04GwAcj6TikEFjKvEGGETm4="; + String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCThndxa2d5wd1XgZw/OoRHyqqhEKn2Vj8esINcPHRDKz/eDxrHT874ssYfRdkQPU4d13yLhywu30D0J/IusB1Aay0Kl7fszYztP1Yg7Y8Gmiwynj4bFooIFZk5l0wJdxciXA4FgjK+oD4Un/LhP20k5OSQ+QLMDBHBJTD/uk9cxQIDAQAB"; + String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJOGd3FrZ3nB3VeBnD86hEfKqqEQqfZWPx6wg1w8dEMrP94PGsdPzviyxh9F2RA9Th3XfIuHLC7fQPQn8i6wHUBrLQqXt+zNjO0/ViDtjwaaLDKePhsWiggVmTmXTAl3FyJcDgWCMr6gPhSf8uE/bSTk5JD5AswMEcElMP+6T1zFAgMBAAECgYAk2fsuTukbRi03db4FIWX31Q2IjHQYf/TmgqtduBBG0x/yJY3H6gzGnUnWeAlAAEBqPfDzncGQt94u32ek+ANmN161r22eBqoihHJQsCD3n3uFw8fdCRzpP9fiJVUFf3Yf/Di2G6cHKJ1Bs8H2GtmajeUUgjNNvJdQXLsTU2DBoQJBAPV9Luzcb62BO9GsL/C6nrxOEPnfTOvpQpBDjb4JnnS8G4CRoEERB8y0p/npD7wrhwG1aEpOj/6XUUz8yAqrA50CQQCZ139/lX0W6TGxZF5RQu9PlKW5/K74Ysd6tvuom93bwLG4zpCgfIoH3mSkWtKENvob7CV07T/irYppa/bIpRlJAkARnsqfdbMOYRhKFHHcdYivO2s8hCqhRDzi3fZujYIyHs5ajBlUkkRdDRqBdZkLiJRIKx0xODJds77CJ+Kz4VKBAkAUf14Bhc1w7Aku9YyLjzuLgubB7STy+1ZQx2iognwA95+2W+9xMqbBfaQzMdayvxB7/+7NsX69mRnEChqLiVPhAkEA6W9YOoZQlL6yCYE4GE3W38g0m7lq68XuVFgCpULEfR3s5bsPcqxC4xM29Ry80cEv6fAE+jht7JUq0ar/tRqfNA=="; + + // String p = "jxsnmqYTsskthlKdpffZ/q/gKfPp9kQpmiNaLg2LqNvyoTnsm+cu7q1ZhmcuK/QH6BKV38dXFgqw3kmEu4X/CKoMHP83vwBSxZhF/uk0SQixRBtpvIIJ/M7XFzyZnUD1u3beEiwbuoWjhtjqq/ImWn7nB54ldc3T/S/lyMS4+Jc="; +// String p2 ="jxsnmqYTsskthlKdpffZ/q/gKfPp9kQpmiNaLg2LqNvyoTnsm+cu7q1ZhmcuK/QH6BKV38dXFgqw3kmEu4X/CKoMHP83vwBSxZhF/uk0SQixRBtpvIIJ/M7XFzyZnUD1u3beEiwbuoWjhtjqq/ImWn7nB54ldc3T/S/lyMS4+Jc="; +// System.out.println(URLEncoder.encode(p,"utf-8")); +// System.out.println(RSA.decrypt(p2,privateKey)); + + BaseUserServiceImpl baseUserService = new BaseUserServiceImpl(); + String mm = baseUserService.encode("Eshop2022"); + System.out.println(mm); + + String mm2 = RSA.encrypt("Eshop2022",publicKey); + + System.out.println(mm2); + + byte[] decode = RSA.decryptByPrivateKey(RSA.decryptBASE64(mm2), privateKey); + + String pw = new String(decode); + System.out.println(pw); + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserTokenServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserTokenServiceImpl.java new file mode 100644 index 0000000..9d51b32 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/BaseUserTokenServiceImpl.java @@ -0,0 +1,45 @@ +package com.chinaunicom.mall.ebtp.login.service.impl; + + +import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl; +import com.chinaunicom.mall.ebtp.login.common.Constants; +import com.chinaunicom.mall.ebtp.login.dao.BaseUserTokenMapper; +import com.chinaunicom.mall.ebtp.login.entity.BaseUserToken; +import com.chinaunicom.mall.ebtp.login.service.BaseUserTokenService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; + +/** + * 对数据表 base_user_token 操作的 serviceImpl + * @author yss + * + */ +@Service +public class BaseUserTokenServiceImpl extends BaseServiceImpl implements BaseUserTokenService { + + @Value("${login.token.time_limit}") + private String valid_time_limit; + + @Override + public boolean refreshToken(BaseUserToken baseUserToken){ + + baseUserToken.setValidTime(LocalDateTime.now().plusMinutes(Long.valueOf(valid_time_limit))); + return this.saveOrUpdate(baseUserToken); + } + + @Override + public boolean saveToken(String id, String userId, String token){ + BaseUserToken userToken = new BaseUserToken(); + userToken.setId(id); + userToken.setUserId(userId); + userToken.setToken(token); + userToken.setState(Constants.USER_TOKEN_STATUS_E); + if(id==null||"".equals(id)) { + userToken.setCreateTime(LocalDateTime.now()); + } + userToken.setValidTime(LocalDateTime.now().plusMinutes(Long.valueOf(valid_time_limit))); + return this.saveOrUpdate(userToken); + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/EshopMenuServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/EshopMenuServiceImpl.java new file mode 100644 index 0000000..5675ee0 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/service/impl/EshopMenuServiceImpl.java @@ -0,0 +1,41 @@ +package com.chinaunicom.mall.ebtp.login.service.impl; + +import com.chinaunicom.mall.ebtp.login.dao.EshopMenuMapper; +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuConverter; +import com.chinaunicom.mall.ebtp.login.entity.EshopMenuQuery; +import com.chinaunicom.mall.ebtp.login.service.EshopMenuService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 菜单权限表 服务实现类 + *

+ * + * @author wangwj + * @since 2020-12-08 + */ +@Slf4j +@Service +public class EshopMenuServiceImpl implements EshopMenuService { + + @Autowired + private EshopMenuMapper eshopMenuMapper; + + /** + * 根据角色查询顶级权限 + * + * @param body + * @return BasePageResponse + * @author chentao + * @date 2021-1-13 + * @update [序号][日期YYYY-MM-DD] [更改人姓名][变更描述] + */ + @Override + public List findTopMenuList(EshopMenuQuery body) { + return this.eshopMenuMapper.findTopMenuList(body.getRoleId()); + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/utils/HttpsUtils.java b/src/main/java/com/chinaunicom/mall/ebtp/login/utils/HttpsUtils.java new file mode 100644 index 0000000..694a39c --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/utils/HttpsUtils.java @@ -0,0 +1,129 @@ +package com.chinaunicom.mall.ebtp.login.utils; + +import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; +import lombok.extern.slf4j.Slf4j; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +@Slf4j +public class HttpsUtils { + public static String refreshHttpPost(String path, String data,String clientId){ + String str = ""; + try { + log.info("-------path:"+path); + log.info("-------data:"+data); + URL url = new URL(path); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + conn.setRequestProperty("clientId", clientId); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setRequestMethod("POST"); + OutputStream out = conn.getOutputStream(); + out.write(data.getBytes()); + out.flush(); + out.close(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + + for(String line = br.readLine(); line != null; line = br.readLine()) { + str = new String(line.getBytes(), "UTF-8"); + System.out.println(str); + } + + is.close(); + conn.disconnect(); + } catch (Exception var9) { + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("请求code换token接口异常"+var9.getMessage(),true); + log.error("请求code换token接口异常",var9); + } + + return str; + } + public static String authorizationCodeHttpPost(String path){ + String str = ""; + try { + URL url = new URL(path); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + PrintWriter out = null; + conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setRequestMethod("POST"); + out = new PrintWriter(conn.getOutputStream()); + out.flush(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + for(String line = br.readLine(); line != null; line = br.readLine()) { + str = new String(line.getBytes(), "UTF-8"); + System.out.println(str); + } + + is.close(); + conn.disconnect(); + } catch (Exception var9) { + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("请求code换token接口异常"+var9.getMessage(),true); + log.error("请求code换token接口异常",var9); + } + + return str; + } + + public static void main(String args[]){ + Map map = new HashMap(); + map.put("identityCard","331081198909263032"); + map.put("password","041461f3e0621be23917ab9c74294083adb9571b82537bc46a2c553938445870e99905a3bf5507e5be462b403954ea4205c5578e3431dec8e3dd8c71ef3b3f615363fe269dea415186188458bb17e6e0d2a6a2f97c58883fb68839748f465df48fc5d5a1961f68"); + map.put("captcha","WRZN"); + map.put("token","toxc5izzhjnjmgc3"); + + map.put("clientId","KgPEkttG"); + + String url = "http://10.242.31.158:8100/auth/expertLogin";//请求地址 + String json = ""; + for(String key :map.keySet()){ + if(!"".equals(json)){ + json+="&"; + } + json+=key+"="+map.get(key); + } + refreshHttpPost(url,json,"KgPEkttG"); + } + + public static String expertHttpPost(String path, String data,String clientId){ + String str = ""; + try { + log.info("-------path:"+path); + log.info("-------data:"+data); + URL url = new URL(path); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); + conn.setRequestProperty("clientId", clientId); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setRequestMethod("POST"); + OutputStream out = conn.getOutputStream(); + out.write(data.getBytes("utf-8")); + out.flush(); + out.close(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + + for(String line = br.readLine(); line != null; line = br.readLine()) { + str = new String(line.getBytes(), "UTF-8"); + System.out.println(str); + } + + is.close(); + conn.disconnect(); + } catch (Exception var9) { + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("专家登录异常"+var9.getMessage(),true); + log.error("专家登录异常",var9); + } + + return str; + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/login/vo/LoginUserVo.java b/src/main/java/com/chinaunicom/mall/ebtp/login/vo/LoginUserVo.java new file mode 100644 index 0000000..8a57a5f --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/login/vo/LoginUserVo.java @@ -0,0 +1,14 @@ +package com.chinaunicom.mall.ebtp.login.vo; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +@Data +@ApiModel("登录用户信息") +public class LoginUserVo { + + private String password; + private String account; + private String identifying; + private String encryptValue; +} diff --git a/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dao/SupplierContactMapper.java b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dao/SupplierContactMapper.java new file mode 100644 index 0000000..b2ed30a --- /dev/null +++ b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dao/SupplierContactMapper.java @@ -0,0 +1,14 @@ +package com.chinaunicom.zyhy.ebtp.supplier.base.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chinaunicom.zyhy.ebtp.supplier.base.entity.SupplierContact; +import org.apache.ibatis.annotations.Mapper; + +/** + * 中远海运供应商联系人Mapper接口 + * @author Craft + * @date 2024-01-29 + */ +@Mapper +public interface SupplierContactMapper extends BaseMapper { +} diff --git a/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dto/ContactDTO.java b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dto/ContactDTO.java new file mode 100644 index 0000000..fe420ef --- /dev/null +++ b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/dto/ContactDTO.java @@ -0,0 +1,13 @@ +package com.chinaunicom.zyhy.ebtp.supplier.base.dto; + +import com.chinaunicom.zyhy.ebtp.supplier.base.entity.SupplierContact; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@ApiModel(description = "中远海运供应商联系人DTO") +public class ContactDTO extends SupplierContact { + private String roleCode; +} diff --git a/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/entity/SupplierContact.java b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/entity/SupplierContact.java new file mode 100644 index 0000000..5bc23ff --- /dev/null +++ b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/entity/SupplierContact.java @@ -0,0 +1,31 @@ +package com.chinaunicom.zyhy.ebtp.supplier.base.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@ApiModel(description = "中远海运供应商基本信息") +@TableName(value = "cosco_supplier_contact", autoResultMap = true) +public class SupplierContact { + @ApiModelProperty(value = "主键ID") + private String id; + @ApiModelProperty(value = "姓名") + private String name; + @ApiModelProperty(value = "电话") + private String phone; + @ApiModelProperty(value = "邮件") + private String email; + @ApiModelProperty(value = "账号") + private String acount; + @ApiModelProperty(value = "主联系人") + private String main; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "供应商基本信息表主键ID") + private String SupplierBaseId; + +} diff --git a/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/vo/ContactSearchVO.java b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/vo/ContactSearchVO.java new file mode 100644 index 0000000..6df8a3b --- /dev/null +++ b/src/main/java/com/chinaunicom/zyhy/ebtp/supplier/base/vo/ContactSearchVO.java @@ -0,0 +1,4 @@ +package com.chinaunicom.zyhy.ebtp.supplier.base.vo; + +public class ContactSearchVO { +} diff --git a/src/main/resources/com/chinaunicom/zyhy/ebtp/supplier/base/dao/mapper/SupplierContactMapper.xml b/src/main/resources/com/chinaunicom/zyhy/ebtp/supplier/base/dao/mapper/SupplierContactMapper.xml new file mode 100644 index 0000000..0f7604e --- /dev/null +++ b/src/main/resources/com/chinaunicom/zyhy/ebtp/supplier/base/dao/mapper/SupplierContactMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + id, name, phone, email, acount, main, status, supplier_base_id + + + + + + + + + + + \ No newline at end of file