Showing
14 changed files
with
246 additions
and
39 deletions
| 1 | +package com.fedex.connect.common.dependencies.enums.sys; | ||
| 2 | + | ||
| 3 | +public enum ParamConfigEnum { | ||
| 4 | + FCL_LOGIN_URL(0L,"fcl_login_url","FCL登陆地址"), | ||
| 5 | + | ||
| 6 | + ; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + private Long code; | ||
| 10 | + private String enMsg; | ||
| 11 | + private String msg; | ||
| 12 | + | ||
| 13 | + ParamConfigEnum(Long code, String enMsg, String msg) { | ||
| 14 | + this.code = code; | ||
| 15 | + this.enMsg = enMsg; | ||
| 16 | + this.msg = msg; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public Long getCode() { | ||
| 20 | + return code; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setCode(Long code) { | ||
| 24 | + this.code = code; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getEnMsg() { | ||
| 28 | + return enMsg; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setEnMsg(String enMsg) { | ||
| 32 | + this.enMsg = enMsg; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getMsg() { | ||
| 36 | + return msg; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setMsg(String msg) { | ||
| 40 | + this.msg = msg; | ||
| 41 | + } | ||
| 42 | +} |
| 1 | +package com.fedex.connect.common.dependencies.enums.sys; | ||
| 2 | + | ||
| 3 | +public enum ParamConfigTypeEnum { | ||
| 4 | + BUTTON(0L,"button","开关"), | ||
| 5 | + THRESHOLD(1L,"threshold","阈值"), | ||
| 6 | + PARAMETER(2L,"parameter","参数"), | ||
| 7 | + ADDRESS(3L,"address","地址"), | ||
| 8 | + | ||
| 9 | + ; | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + private Long code; | ||
| 13 | + private String enMsg; | ||
| 14 | + private String msg; | ||
| 15 | + | ||
| 16 | + ParamConfigTypeEnum(Long code, String enMsg, String msg) { | ||
| 17 | + this.code = code; | ||
| 18 | + this.enMsg = enMsg; | ||
| 19 | + this.msg = msg; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public Long getCode() { | ||
| 23 | + return code; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setCode(Long code) { | ||
| 27 | + this.code = code; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public String getEnMsg() { | ||
| 31 | + return enMsg; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setEnMsg(String enMsg) { | ||
| 35 | + this.enMsg = enMsg; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public String getMsg() { | ||
| 39 | + return msg; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setMsg(String msg) { | ||
| 43 | + this.msg = msg; | ||
| 44 | + } | ||
| 45 | +} |
| 1 | package com.fedex.connect.common.dependencies.enums.sys; | 1 | package com.fedex.connect.common.dependencies.enums.sys; |
| 2 | 2 | ||
| 3 | public enum UserLoginTypeEnum { | 3 | public enum UserLoginTypeEnum { |
| 4 | - LOGIN(0L,"Login","登录"), | 4 | + LOGIN("userLoginType_01","Login","登录"), |
| 5 | - EXIT(1L,"Exit","退出"), | 5 | + EXIT("userLoginType_02","Exit","退出"), |
| 6 | - CHANGEPASSWORD(2L,"ChangePassword","修改密码"), | 6 | + CHANGEPASSWORD("userLoginType_03","ChangePassword","修改密码"), |
| 7 | - FCLLOGINREGISTRATION(3L,"FCLLoginRegistration","FCL登录注册"), | 7 | + FCLLOGINREGISTRATION("userLoginType_04","FCLLoginRegistration","FCL登录注册"), |
| 8 | - DEACTIVATE(4L,"Deactivate","停用"), | 8 | + DEACTIVATE("userLoginType_05","Deactivate","停用"), |
| 9 | - ENABLE(5L,"Enable","启用"), | 9 | + ENABLE("userLoginType_06","Enable","启用"), |
| 10 | ; | 10 | ; |
| 11 | - private Long code; | 11 | + private String code; |
| 12 | private String enMsg; | 12 | private String enMsg; |
| 13 | private String msg; | 13 | private String msg; |
| 14 | 14 | ||
| 15 | - UserLoginTypeEnum(Long code, String enMsg,String msg) { | 15 | + UserLoginTypeEnum(String code, String enMsg,String msg) { |
| 16 | this.code = code; | 16 | this.code = code; |
| 17 | this.enMsg = enMsg; | 17 | this.enMsg = enMsg; |
| 18 | this.msg = msg; | 18 | this.msg = msg; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | - public Long getCode() { | 21 | + public String getCode() { |
| 22 | return code; | 22 | return code; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | - public void setCode(Long code) { | 25 | + public void setCode(String code) { |
| 26 | this.code = code; | 26 | this.code = code; |
| 27 | } | 27 | } |
| 28 | 28 | ... | ... |
| ... | @@ -15,4 +15,7 @@ public class PropertiesConfig { | ... | @@ -15,4 +15,7 @@ public class PropertiesConfig { |
| 15 | 15 | ||
| 16 | @Value("${fcl.login.redjrectLogin}") | 16 | @Value("${fcl.login.redjrectLogin}") |
| 17 | private String redjrectLogin; | 17 | private String redjrectLogin; |
| 18 | + | ||
| 19 | + @Value("${spring.profiles.env}") | ||
| 20 | + private String env; | ||
| 18 | } | 21 | } | ... | ... |
| ... | @@ -3,10 +3,10 @@ package com.fedex.connect.manager.controller.sys.impl; | ... | @@ -3,10 +3,10 @@ package com.fedex.connect.manager.controller.sys.impl; |
| 3 | 3 | ||
| 4 | import com.fedex.connect.common.dependencies.cache.CacheSystem; | 4 | import com.fedex.connect.common.dependencies.cache.CacheSystem; |
| 5 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | 5 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; |
| 6 | +import com.fedex.connect.common.dependencies.enums.sys.ParamConfigEnum; | ||
| 6 | import com.fedex.connect.common.dependencies.enums.sys.UserLoginTypeEnum; | 7 | import com.fedex.connect.common.dependencies.enums.sys.UserLoginTypeEnum; |
| 7 | import com.fedex.connect.common.dependencies.util.GsonUtils; | 8 | import com.fedex.connect.common.dependencies.util.GsonUtils; |
| 8 | import com.fedex.connect.common.dependencies.util.StringExtUtil; | 9 | import com.fedex.connect.common.dependencies.util.StringExtUtil; |
| 9 | -import com.fedex.connect.common.dependencies.util.Utils; | ||
| 10 | import com.fedex.connect.common.model.bi.DictionaryEntries; | 10 | import com.fedex.connect.common.model.bi.DictionaryEntries; |
| 11 | import com.fedex.connect.common.model.sys.User; | 11 | import com.fedex.connect.common.model.sys.User; |
| 12 | import com.fedex.connect.manager.common.enums.FCLSessionInfoEnum; | 12 | import com.fedex.connect.manager.common.enums.FCLSessionInfoEnum; |
| ... | @@ -15,7 +15,7 @@ import com.fedex.connect.manager.controller.sys.ISysAuthController; | ... | @@ -15,7 +15,7 @@ import com.fedex.connect.manager.controller.sys.ISysAuthController; |
| 15 | import com.fedex.connect.manager.data.dto.LogLoginDto; | 15 | import com.fedex.connect.manager.data.dto.LogLoginDto; |
| 16 | import com.fedex.connect.manager.data.dto.LoginRequest; | 16 | import com.fedex.connect.manager.data.dto.LoginRequest; |
| 17 | import com.fedex.connect.manager.data.dto.SysUserDto; | 17 | import com.fedex.connect.manager.data.dto.SysUserDto; |
| 18 | -import com.fedex.connect.manager.enums.ResponseCode; | 18 | +import com.fedex.connect.manager.util.ParamConfigUtil; |
| 19 | import com.google.gson.JsonObject; | 19 | import com.google.gson.JsonObject; |
| 20 | import io.swagger.annotations.Api; | 20 | import io.swagger.annotations.Api; |
| 21 | import io.swagger.annotations.ApiOperation; | 21 | import io.swagger.annotations.ApiOperation; |
| ... | @@ -44,6 +44,8 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -44,6 +44,8 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 44 | @Autowired | 44 | @Autowired |
| 45 | CacheSystem cacheSystem; | 45 | CacheSystem cacheSystem; |
| 46 | 46 | ||
| 47 | + @Autowired | ||
| 48 | + private ParamConfigUtil paramConfigUtil; | ||
| 47 | 49 | ||
| 48 | @Value("${fcl.interface.logurl}") | 50 | @Value("${fcl.interface.logurl}") |
| 49 | private String fclIndexLoginUrl; | 51 | private String fclIndexLoginUrl; |
| ... | @@ -55,6 +57,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -55,6 +57,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | 59 | ||
| 60 | + /** | ||
| 61 | + * @Author Szl | ||
| 62 | + * @Description 功能说明 fcl登陆首个接口,获取fcl信息 | ||
| 63 | + * @Date 2024/11/11 | ||
| 64 | + * @param request | ||
| 65 | + * @param res | ||
| 66 | + * @return void | ||
| 67 | + */ | ||
| 58 | @GetMapping(value = "/wlgnForward") | 68 | @GetMapping(value = "/wlgnForward") |
| 59 | @ApiOperation(value = "ResponseVo", notes = "FCL中转Cookie地址") | 69 | @ApiOperation(value = "ResponseVo", notes = "FCL中转Cookie地址") |
| 60 | public void wlgnForward(HttpServletRequest request, HttpServletResponse res){ | 70 | public void wlgnForward(HttpServletRequest request, HttpServletResponse res){ |
| ... | @@ -64,31 +74,16 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -64,31 +74,16 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 64 | if (!equals){ | 74 | if (!equals){ |
| 65 | return; | 75 | return; |
| 66 | } | 76 | } |
| 67 | - | ||
| 68 | - Cookie[] cookies = request.getCookies(); | ||
| 69 | - if (Utils.isEmpty(cookies)){ | ||
| 70 | - return; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - List<String> saveKeyList = FCLSessionInfoEnum.getCodeList(); | ||
| 74 | List<String> cookiesList = new ArrayList(); | 77 | List<String> cookiesList = new ArrayList(); |
| 75 | - for (int i = 0, max = cookies.length; i < max; i++) { | 78 | + List<String> saveKeyList = FCLSessionInfoEnum.getCodeList(); |
| 76 | - Cookie cookie = cookies[i]; | 79 | + sysUserService.getFclData(request,cookiesList,saveKeyList); |
| 77 | - if(saveKeyList.contains(cookie.getName())){ | ||
| 78 | - cookiesList.add("'"+cookie.getName()+"':'"+cookie.getValue()+"'"); | ||
| 79 | - if(cookiesList.size() == saveKeyList.size()){ | ||
| 80 | - break; | ||
| 81 | - } | ||
| 82 | - } | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | if (cookiesList.size() > 0 && cookiesList.size() == saveKeyList.size()){ | 80 | if (cookiesList.size() > 0 && cookiesList.size() == saveKeyList.size()){ |
| 86 | JsonObject jsonObject = GsonUtils.stringToBean("{"+String.join(",",cookiesList)+"}",JsonObject.class); | 81 | JsonObject jsonObject = GsonUtils.stringToBean("{"+String.join(",",cookiesList)+"}",JsonObject.class); |
| 87 | - //set cookie by fcl_key | ||
| 88 | ResponseVo tokenResult = sysAuthService.createFclToken(jsonObject); | 82 | ResponseVo tokenResult = sysAuthService.createFclToken(jsonObject); |
| 89 | if (tokenResult.isSuccess()){ | 83 | if (tokenResult.isSuccess()){ |
| 90 | String fcl_token_key = String.valueOf(tokenResult.getData()); | 84 | String fcl_token_key = String.valueOf(tokenResult.getData()); |
| 91 | - String redirectUrl = String.format("%s?token=%s", propertiesConfig.getFclLoginUrl(), fcl_token_key); | 85 | + String redirectUrl = String.format("%s?token=%s", paramConfigUtil.getParamValue(ParamConfigEnum.FCL_LOGIN_URL.getEnMsg()), fcl_token_key); |
| 86 | + System.out.println(redirectUrl); | ||
| 92 | res.sendRedirect(redirectUrl); | 87 | res.sendRedirect(redirectUrl); |
| 93 | } | 88 | } |
| 94 | }else { | 89 | }else { |
| ... | @@ -100,6 +95,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -100,6 +95,14 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 100 | } | 95 | } |
| 101 | } | 96 | } |
| 102 | 97 | ||
| 98 | + /** | ||
| 99 | + * @Author Szl | ||
| 100 | + * @Description 功能说明 FCL登陆第二个接口,生成token | ||
| 101 | + * @Date 2024/11/11 | ||
| 102 | + * @param request | ||
| 103 | + * @param res | ||
| 104 | + * @return void | ||
| 105 | + */ | ||
| 103 | @GetMapping(value = "/wlgnLogin") | 106 | @GetMapping(value = "/wlgnLogin") |
| 104 | @ApiOperation(value = "ResponseVo", notes = "FCL登录") | 107 | @ApiOperation(value = "ResponseVo", notes = "FCL登录") |
| 105 | public void wlgnLogin(HttpServletRequest request, HttpServletResponse res) { | 108 | public void wlgnLogin(HttpServletRequest request, HttpServletResponse res) { |
| ... | @@ -146,17 +149,17 @@ public class SysAuthController extends BaseController implements ISysAuthControl | ... | @@ -146,17 +149,17 @@ public class SysAuthController extends BaseController implements ISysAuthControl |
| 146 | ResponseVo tokenResult = sysAuthService.createAccessToken(loginRequest, loginUser); | 149 | ResponseVo tokenResult = sysAuthService.createAccessToken(loginRequest, loginUser); |
| 147 | 150 | ||
| 148 | 151 | ||
| 149 | - DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.FCLLOGINREGISTRATION.getEnMsg()); | 152 | + DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.FCLLOGINREGISTRATION.getCode()); |
| 150 | //记录日志 | 153 | //记录日志 |
| 151 | LogLoginDto dto = new LogLoginDto(loginUser.getId(), dicUserLoginType.getId(), | 154 | LogLoginDto dto = new LogLoginDto(loginUser.getId(), dicUserLoginType.getId(), |
| 152 | - localeMessageUtil.getMessage(ResponseCode.MESSAGE_CODE_40002.getMsg())); | 155 | + UserLoginTypeEnum.LOGIN.getMsg()); |
| 153 | logLoginService.saveLoginLog(dto); | 156 | logLoginService.saveLoginLog(dto); |
| 154 | 157 | ||
| 155 | try{ | 158 | try{ |
| 156 | if (tokenResult.isSuccess()){ | 159 | if (tokenResult.isSuccess()){ |
| 157 | String redirectUrl = String.format("%s?token=%s&uid=%s", propertiesConfig.getRedjrectLogin(), tokenResult.getData(), loginUser.getId()); | 160 | String redirectUrl = String.format("%s?token=%s&uid=%s", propertiesConfig.getRedjrectLogin(), tokenResult.getData(), loginUser.getId()); |
| 158 | res.sendRedirect(redirectUrl); | 161 | res.sendRedirect(redirectUrl); |
| 159 | - log.info("wlgnLogin____________________finish"); | 162 | + log.info("wlgnLogin____________________finish:"+redirectUrl); |
| 160 | }else { | 163 | }else { |
| 161 | res.sendRedirect(propertiesConfig.getTwIdxUrl()); | 164 | res.sendRedirect(propertiesConfig.getTwIdxUrl()); |
| 162 | } | 165 | } | ... | ... |
| ... | @@ -39,10 +39,9 @@ public class SysUserDto { | ... | @@ -39,10 +39,9 @@ public class SysUserDto { |
| 39 | user.setCustomsSerialNum(dto.getCustomsSerialNum()); | 39 | user.setCustomsSerialNum(dto.getCustomsSerialNum()); |
| 40 | user.setCreateTime(new Date()); | 40 | user.setCreateTime(new Date()); |
| 41 | user.setModifyTime(new Date()); | 41 | user.setModifyTime(new Date()); |
| 42 | - user.setTypeId(0L); | ||
| 43 | user.setStatus(DatabaseConstants.GLOBAL_STATUS_VALID); | 42 | user.setStatus(DatabaseConstants.GLOBAL_STATUS_VALID); |
| 44 | user.setRemark(dto.getRemark()); | 43 | user.setRemark(dto.getRemark()); |
| 45 | - user.setTypeId(dto.getTypeId()); | 44 | + user.setTypeCode(dto.getTypeCode()); |
| 46 | return user; | 45 | return user; |
| 47 | } | 46 | } |
| 48 | 47 | ||
| ... | @@ -56,7 +55,7 @@ public class SysUserDto { | ... | @@ -56,7 +55,7 @@ public class SysUserDto { |
| 56 | } else { | 55 | } else { |
| 57 | this.userName = fcl_acc_no; | 56 | this.userName = fcl_acc_no; |
| 58 | } | 57 | } |
| 59 | - | 58 | + this.typeCode = UserTypeEnum.FCL.getEnMsg(); |
| 60 | this.password = fcl_pwd; | 59 | this.password = fcl_pwd; |
| 61 | this.loginName = uuid; | 60 | this.loginName = uuid; |
| 62 | this.email = null; | 61 | this.email = null; | ... | ... |
| ... | @@ -6,6 +6,7 @@ import com.fedex.connect.common.dao.sys.RedisSlabMapper; | ... | @@ -6,6 +6,7 @@ import com.fedex.connect.common.dao.sys.RedisSlabMapper; |
| 6 | import com.fedex.connect.common.dao.sys.RoleMapper; | 6 | import com.fedex.connect.common.dao.sys.RoleMapper; |
| 7 | import com.fedex.connect.common.dao.sys.UserMapper; | 7 | import com.fedex.connect.common.dao.sys.UserMapper; |
| 8 | import com.fedex.connect.common.dao.sys.UserRoleMapper; | 8 | import com.fedex.connect.common.dao.sys.UserRoleMapper; |
| 9 | +import com.fedex.connect.manager.repository.dao.ParamConfigExtMapper; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 11 | ||
| 11 | public class BaseDao { | 12 | public class BaseDao { |
| ... | @@ -21,4 +22,6 @@ public class BaseDao { | ... | @@ -21,4 +22,6 @@ public class BaseDao { |
| 21 | public UserMapper userMapper; | 22 | public UserMapper userMapper; |
| 22 | @Autowired | 23 | @Autowired |
| 23 | public DictionaryEntriesMapper dictionaryEntriesMapper; | 24 | public DictionaryEntriesMapper dictionaryEntriesMapper; |
| 25 | + @Autowired | ||
| 26 | + public ParamConfigExtMapper paramConfigExtMapper; | ||
| 24 | } | 27 | } | ... | ... |
| 1 | +package com.fedex.connect.manager.repository.dao; | ||
| 2 | + | ||
| 3 | +import org.apache.ibatis.annotations.Param; | ||
| 4 | +import org.apache.ibatis.annotations.Select; | ||
| 5 | + | ||
| 6 | +public interface ParamConfigExtMapper { | ||
| 7 | + | ||
| 8 | + @Select("SELECT VALUE FROM T_SYS_PARAM_CONFIG WHERE CODE = #{code}") | ||
| 9 | + String findValueByCode(@Param("code") String code); | ||
| 10 | +} |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="com.fedex.connect.manager.repository.dao.ParamConfigExtMapper"> | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +</mapper> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.manager.repository.repo.sys.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.manager.repository.base.BaseDao; | ||
| 4 | +import com.fedex.connect.manager.repository.repo.sys.IParamConfigExtRepository; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +@Repository | ||
| 8 | +public class ParamConfigExtRepositoryImpl extends BaseDao implements IParamConfigExtRepository { | ||
| 9 | + | ||
| 10 | + @Override | ||
| 11 | + public String findValueByCode(String code) { | ||
| 12 | + return paramConfigExtMapper.findValueByCode(code); | ||
| 13 | + } | ||
| 14 | +} |
| ... | @@ -3,10 +3,15 @@ package com.fedex.connect.manager.service.sys; | ... | @@ -3,10 +3,15 @@ package com.fedex.connect.manager.service.sys; |
| 3 | import com.fedex.connect.common.model.sys.User; | 3 | import com.fedex.connect.common.model.sys.User; |
| 4 | import com.fedex.connect.manager.data.dto.SysUserDto; | 4 | import com.fedex.connect.manager.data.dto.SysUserDto; |
| 5 | 5 | ||
| 6 | +import javax.servlet.http.HttpServletRequest; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 6 | public interface ISysUserService { | 9 | public interface ISysUserService { |
| 7 | User findUserByFcl(String fclUuid); | 10 | User findUserByFcl(String fclUuid); |
| 8 | 11 | ||
| 9 | User save(SysUserDto dto); | 12 | User save(SysUserDto dto); |
| 10 | 13 | ||
| 11 | int update(User dao); | 14 | int update(User dao); |
| 15 | + | ||
| 16 | + void getFclData(HttpServletRequest request,List<String> cookiesList,List<String> saveKeyList); | ||
| 12 | } | 17 | } | ... | ... |
| ... | @@ -10,6 +10,7 @@ import com.fedex.connect.common.model.bi.DictionaryEntries; | ... | @@ -10,6 +10,7 @@ import com.fedex.connect.common.model.bi.DictionaryEntries; |
| 10 | import com.fedex.connect.common.model.sys.Role; | 10 | import com.fedex.connect.common.model.sys.Role; |
| 11 | import com.fedex.connect.common.model.sys.User; | 11 | import com.fedex.connect.common.model.sys.User; |
| 12 | import com.fedex.connect.common.model.sys.UserExample; | 12 | import com.fedex.connect.common.model.sys.UserExample; |
| 13 | +import com.fedex.connect.manager.config.PropertiesConfig; | ||
| 13 | import com.fedex.connect.manager.data.dto.SysUserDto; | 14 | import com.fedex.connect.manager.data.dto.SysUserDto; |
| 14 | import com.fedex.connect.manager.data.model.LogShowModel; | 15 | import com.fedex.connect.manager.data.model.LogShowModel; |
| 15 | import com.fedex.connect.manager.service.base.BaseService; | 16 | import com.fedex.connect.manager.service.base.BaseService; |
| ... | @@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Value; | ... | @@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Value; |
| 24 | import org.springframework.stereotype.Service; | 25 | import org.springframework.stereotype.Service; |
| 25 | import org.springframework.transaction.annotation.Transactional; | 26 | import org.springframework.transaction.annotation.Transactional; |
| 26 | 27 | ||
| 28 | +import javax.servlet.http.Cookie; | ||
| 29 | +import javax.servlet.http.HttpServletRequest; | ||
| 27 | import java.util.List; | 30 | import java.util.List; |
| 28 | import java.util.Objects; | 31 | import java.util.Objects; |
| 29 | import java.util.stream.Collectors; | 32 | import java.util.stream.Collectors; |
| ... | @@ -45,6 +48,9 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { | ... | @@ -45,6 +48,9 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { |
| 45 | @Autowired | 48 | @Autowired |
| 46 | CacheSystem cacheSystem; | 49 | CacheSystem cacheSystem; |
| 47 | 50 | ||
| 51 | + @Autowired | ||
| 52 | + private PropertiesConfig propertiesConfig; | ||
| 53 | + | ||
| 48 | /** | 54 | /** |
| 49 | * 邮件过期时间 | 55 | * 邮件过期时间 |
| 50 | */ | 56 | */ |
| ... | @@ -92,9 +98,9 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { | ... | @@ -92,9 +98,9 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { |
| 92 | //从数据字典获取用户类型 | 98 | //从数据字典获取用户类型 |
| 93 | DictionaryEntries dicUserType = cacheSystem.getDicUserType(dto.getTypeCode()); | 99 | DictionaryEntries dicUserType = cacheSystem.getDicUserType(dto.getTypeCode()); |
| 94 | if (dicUserType != null){ | 100 | if (dicUserType != null){ |
| 95 | - user.setTypeId(dicUserType.getId()); | 101 | + user.setTypeCode(dicUserType.getCode()); |
| 96 | }else { | 102 | }else { |
| 97 | - user.setTypeId(0L); | 103 | + user.setTypeCode("0"); |
| 98 | } | 104 | } |
| 99 | //对新增账户的密码进行加密 | 105 | //对新增账户的密码进行加密 |
| 100 | user.setPassword(EncryptProvider.encrypt(user.getPassword())); | 106 | user.setPassword(EncryptProvider.encrypt(user.getPassword())); |
| ... | @@ -146,5 +152,43 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { | ... | @@ -146,5 +152,43 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { |
| 146 | } | 152 | } |
| 147 | } | 153 | } |
| 148 | 154 | ||
| 155 | + /** | ||
| 156 | + * @Author Szl | ||
| 157 | + * @Description 功能说明 测试环境中使用Parameter获取fcl信息 | ||
| 158 | + * @Date 2024/11/11 | ||
| 159 | + * @param request | ||
| 160 | + * @param cookiesList | ||
| 161 | + * @param saveKeyList | ||
| 162 | + * @return void | ||
| 163 | + */ | ||
| 164 | + @Override | ||
| 165 | + public void getFclData(HttpServletRequest request,List<String> cookiesList,List<String> saveKeyList) { | ||
| 166 | + if (!propertiesConfig.getEnv().equalsIgnoreCase("dev") | ||
| 167 | + && !propertiesConfig.getEnv().equalsIgnoreCase("test") | ||
| 168 | + && !propertiesConfig.getEnv().equalsIgnoreCase("uat")) { | ||
| 169 | + Cookie[] cookies = request.getCookies(); | ||
| 170 | + if (Utils.isEmpty(cookies)){ | ||
| 171 | + return; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + for (int i = 0, max = cookies.length; i < max; i++) { | ||
| 175 | + Cookie cookie = cookies[i]; | ||
| 176 | + if(saveKeyList.contains(cookie.getName())){ | ||
| 177 | + cookiesList.add("'"+cookie.getName()+"':'"+cookie.getValue()+"'"); | ||
| 178 | + if(cookiesList.size() == saveKeyList.size()){ | ||
| 179 | + break; | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + }else { | ||
| 184 | + for (String key : saveKeyList) { | ||
| 185 | + String value = request.getParameter(key); | ||
| 186 | + if (!StringUtils.isEmpty(value)){ | ||
| 187 | + cookiesList.add("'" + key + "':'" + value + "'"); | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + | ||
| 149 | 193 | ||
| 150 | } | 194 | } | ... | ... |
| 1 | +package com.fedex.connect.manager.util; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.manager.repository.repo.sys.IParamConfigExtRepository; | ||
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | +import org.springframework.stereotype.Component; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @Author Szl | ||
| 9 | + * @Description 类说明 用于系统参数配置 | ||
| 10 | + * @Date 2024/11/11 | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +public class ParamConfigUtil { | ||
| 14 | + | ||
| 15 | + @Autowired | ||
| 16 | + private IParamConfigExtRepository paramConfigExtRepository; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @Author Szl | ||
| 20 | + * @Description 功能说明 根据code从系统参数配置获取value | ||
| 21 | + * @Date 2024/11/11 | ||
| 22 | + * @param code | ||
| 23 | + * @return java.lang.String | ||
| 24 | + */ | ||
| 25 | + public String getParamValue(String code){ | ||
| 26 | + return paramConfigExtRepository.findValueByCode(code); | ||
| 27 | + } | ||
| 28 | +} |
-
Please register or login to post a comment