Commit 444db462 authored by tianbo's avatar tianbo

refactor(security): 替换DES加密为PWD工具类

- 修改多个模块(96333、cylinder、tcm、ymt)的WechatController密码加密实现 - 统一使用PwdUtil进行密码编码处理
parent dfd8bedf
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.model.LoginInfoModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import io.swagger.annotations.Api;
......@@ -314,7 +315,7 @@ public class WechatController extends BaseController {
startPlatformTokenService.getToken();
logger.info("========================请求登录接口token" + RequestContext.getToken());
FeignClientResult<LoginInfoModel> loginInfo = Privilege.agencyUserClient.getLoginInfo(model.getPhone());
String passwd = DesUtil.encode("a_" + model.getPhone(), "qaz");
String passwd = PwdUtil.encode("a_" + model.getPhone());
if (loginInfo == null || loginInfo.getResult() == null) {
AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(model.getPhone());
......
package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
import com.yeejoin.amos.boot.module.elevator.api.common.CommonException;
import com.yeejoin.amos.boot.module.elevator.api.common.DesUtil;
import com.yeejoin.amos.boot.module.elevator.api.common.MobileLoginParam;
import com.yeejoin.amos.boot.module.elevator.api.enums.PersonCheckStatus;
import com.yeejoin.amos.boot.module.elevator.api.enums.PhoneRegisterTypeEum;
import com.yeejoin.amos.boot.module.elevator.api.service.ISafetyService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.RedisUtil;
import com.yeejoin.amos.boot.module.elevator.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.elevator.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.elevator.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @Author cpp
......@@ -105,7 +101,7 @@ public class SafetyServiceImpl implements ISafetyService {
//验证手机号是否注册过
VerifyCodeAuthModel model = new VerifyCodeAuthModel();
model.setLoginId(param.getPhoneNo());
model.setVerifyCode(DesUtil.encode(param.getPhoneNo(), param.getPhoneNo()));
model.setVerifyCode(PwdUtil.encode(param.getPhoneNo()));
FeignClientResult<Map<String, String>> mobileVerifyCodeResult = new FeignClientResult<>();
RequestContext.setToken("token");
RequestContext.setProduct(product);
......
......@@ -16,6 +16,12 @@ spring.cloud.nacos.config.namespace=qa
spring.cloud.nacos.config.group=DEFAULT_GROUP
spring.cloud.nacos.config.file-extension=properties
#DB properties:
spring.datasource.url=jdbc:postgresql://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023
spring.datasource.hikari.register-mbeans=true
## ES properties:
elasticsearch.username=elastic
elasticsearch.password=a123456
......
......@@ -16,6 +16,12 @@ spring.cloud.nacos.config.namespace=qa
spring.cloud.nacos.config.group=DEFAULT_GROUP
spring.cloud.nacos.config.file-extension=properties
#DB properties:
spring.datasource.url=jdbc:postgresql://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username=admin
spring.datasource.password=Yeejoin@2023
spring.datasource.hikari.register-mbeans=true
## ES properties:
elasticsearch.username=elastic
elasticsearch.password=a123456
......
......@@ -7,14 +7,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.cylinder.biz.utils.HttpUtils;
import com.yeejoin.amos.boot.module.cylinder.api.dto.SignatureDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WechatAccessDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WechatRelationDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.WechatTaskLatLonDto;
import com.yeejoin.amos.boot.module.cylinder.api.dto.*;
import com.yeejoin.amos.boot.module.cylinder.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.cylinder.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.cylinder.api.entity.WechatRelation;
......@@ -24,11 +17,13 @@ import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.AlertCalledService
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.DispatchTaskServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.cylinder.biz.utils.HttpUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import io.swagger.annotations.Api;
......@@ -42,13 +37,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -66,13 +55,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 微信公众号controller
......@@ -311,7 +294,7 @@ public class WechatController extends BaseController {
|| ValidationUtil.isEmpty(model.getCode()))
throw new BadRequest("参数校验失败.");
AgencyUserModel agencyUserModel = new AgencyUserModel();
String passwd = DesUtil.encode("a_" + model.getPhone(), "qaz");
String passwd = PwdUtil.encode("a_" + model.getPhone());
agencyUserModel.setUserName(model.getPhone());
agencyUserModel.setRealName(model.getPhone());
agencyUserModel.setLockStatus("UNLOCK");
......
package com.yeejoin.amos.boot.module.cylinder.biz.service.impl;
import com.yeejoin.amos.boot.module.cylinder.biz.utils.RedisUtil;
import com.yeejoin.amos.boot.module.cylinder.api.common.CommonException;
import com.yeejoin.amos.boot.module.cylinder.api.common.DesUtil;
import com.yeejoin.amos.boot.module.cylinder.api.common.MobileLoginParam;
import com.yeejoin.amos.boot.module.cylinder.api.enums.PersonCheckStatus;
import com.yeejoin.amos.boot.module.cylinder.api.enums.PhoneRegisterTypeEum;
import com.yeejoin.amos.boot.module.cylinder.api.service.ISafetyService;
import com.yeejoin.amos.boot.module.cylinder.biz.utils.RedisUtil;
import com.yeejoin.amos.boot.module.cylinder.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @Author cpp
......@@ -104,7 +101,7 @@ public class SafetyServiceImpl implements ISafetyService {
//验证手机号是否注册过
VerifyCodeAuthModel model = new VerifyCodeAuthModel();
model.setLoginId(param.getPhoneNo());
model.setVerifyCode(DesUtil.encode(param.getPhoneNo(), param.getPhoneNo()));
model.setVerifyCode(PwdUtil.encode(param.getPhoneNo()));
FeignClientResult<Map<String, String>> mobileVerifyCodeResult = new FeignClientResult<>();
RequestContext.setToken("token");
RequestContext.setProduct(product);
......
......@@ -7,13 +7,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tcm.api.dto.SignatureDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatAccessDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatRelationDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.WechatTaskLatLonDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.*;
import com.yeejoin.amos.boot.module.tcm.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tcm.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.tcm.api.entity.WechatRelation;
......@@ -29,6 +23,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import io.swagger.annotations.Api;
......@@ -42,13 +37,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -66,13 +55,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 微信公众号controller
......@@ -311,7 +294,7 @@ public class WechatController extends BaseController {
|| ValidationUtil.isEmpty(model.getCode()))
throw new BadRequest("参数校验失败.");
AgencyUserModel agencyUserModel = new AgencyUserModel();
String passwd = DesUtil.encode("a_" + model.getPhone(), "qaz");
String passwd = PwdUtil.encode("a_" + model.getPhone());
agencyUserModel.setUserName(model.getPhone());
agencyUserModel.setRealName(model.getPhone());
agencyUserModel.setLockStatus("UNLOCK");
......
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -103,7 +104,7 @@ public class SafetyServiceImpl implements ISafetyService {
//验证手机号是否注册过
VerifyCodeAuthModel model = new VerifyCodeAuthModel();
model.setLoginId(param.getPhoneNo());
model.setVerifyCode(DesUtil.encode(param.getPhoneNo(), param.getPhoneNo()));
model.setVerifyCode(PwdUtil.encode(param.getPhoneNo()));
FeignClientResult<Map<String, String>> mobileVerifyCodeResult = new FeignClientResult<>();
RequestContext.setToken("token");
RequestContext.setProduct(product);
......
......@@ -65,7 +65,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -2159,7 +2159,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
CompanyModel companyModel = getCompanyModelUseCache(tzsUserInfo, companyCodeCompanyMap);
String companyType = companyModel.getCompanyType();
// 默认的密码
String passwd = DesUtil.encode("a_" + tzsUserInfo.getPhone(), "qaz");
String passwd = PwdUtil.encode("a_" + tzsUserInfo.getPhone());
// 获取对应单位类型下的引用并去重
Set<String> appCodesSet = getAppKeys(userImportDto, dataDictionaryMap);
Set<Long> roleIds = new HashSet<>();
......
......@@ -7,13 +7,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.ymt.api.dto.SignatureDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.WechatAccessDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.WechatRelationDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.WechatTaskLatLonDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.ymt.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.ymt.api.entity.WechatRelation;
......@@ -29,6 +23,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import io.swagger.annotations.Api;
......@@ -42,13 +37,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -66,13 +55,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 微信公众号controller
......@@ -311,7 +294,7 @@ public class WechatController extends BaseController {
|| ValidationUtil.isEmpty(model.getCode()))
throw new BadRequest("参数校验失败.");
AgencyUserModel agencyUserModel = new AgencyUserModel();
String passwd = DesUtil.encode("a_" + model.getPhone(), "qaz");
String passwd = PwdUtil.encode("a_" + model.getPhone());
agencyUserModel.setUserName(model.getPhone());
agencyUserModel.setRealName(model.getPhone());
agencyUserModel.setLockStatus("UNLOCK");
......
package com.yeejoin.amos.boot.module.ymt.biz.service.impl;
import com.yeejoin.amos.boot.module.ymt.api.common.CommonException;
import com.yeejoin.amos.boot.module.ymt.api.common.DesUtil;
import com.yeejoin.amos.boot.module.ymt.api.common.MobileLoginParam;
import com.yeejoin.amos.boot.module.ymt.api.enums.PersonCheckStatus;
import com.yeejoin.amos.boot.module.ymt.api.enums.PhoneRegisterTypeEum;
import com.yeejoin.amos.boot.module.ymt.api.service.ISafetyService;
import com.yeejoin.amos.boot.module.ymt.biz.utils.RedisUtil;
import com.yeejoin.amos.boot.module.ymt.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.ymt.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import com.yeejoin.amos.feign.privilege.util.PwdUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @Author cpp
......@@ -105,7 +101,7 @@ public class SafetyServiceImpl implements ISafetyService {
//验证手机号是否注册过
VerifyCodeAuthModel model = new VerifyCodeAuthModel();
model.setLoginId(param.getPhoneNo());
model.setVerifyCode(DesUtil.encode(param.getPhoneNo(), param.getPhoneNo()));
model.setVerifyCode(PwdUtil.encode(param.getPhoneNo()));
FeignClientResult<Map<String, String>> mobileVerifyCodeResult = new FeignClientResult<>();
RequestContext.setToken("token");
RequestContext.setProduct(product);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment