fix: 去掉Dongle校验

main
huangfeng 9 months ago
parent a0657a059a
commit 433811f731

@ -41,9 +41,9 @@ public class AppLoginController {
@PostMapping(value = "/login", produces = { "application/json;charset=utf-8" }) @PostMapping(value = "/login", produces = { "application/json;charset=utf-8" })
public Map<String, Object> login(@RequestBody UserDTO user) throws UnknownHostException { public Map<String, Object> login(@RequestBody UserDTO user) throws UnknownHostException {
log.info("*************"); log.info("*************");
if(!busiHomePageService.verifyDongle()){ // if(!busiHomePageService.verifyDongle()){
return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null); // return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null);
} // }
return loginService.login(user,time); return loginService.login(user,time);
} }
} }

@ -182,9 +182,9 @@ public class BusiHomePageController {
@RequestParam(value = "limit", required = false) Integer limit, @RequestParam(value = "limit", required = false) Integer limit,
@RequestParam(value = "warningTime", required = false) String warningTime, @RequestParam(value = "warningTime", required = false) String warningTime,
@RequestParam(value = "warningTimeEnd", required = false) String warningTimeEnd) throws UnknownHostException { @RequestParam(value = "warningTimeEnd", required = false) String warningTimeEnd) throws UnknownHostException {
if(!busiHomePageService.verifyDongle()){ // if(!busiHomePageService.verifyDongle()){
return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null); // return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null);
} // }
BusiEqmWarningDto busiEqmWarningDto = new BusiEqmWarningDto(); BusiEqmWarningDto busiEqmWarningDto = new BusiEqmWarningDto();
busiEqmWarningDto.setEqType(eqType); busiEqmWarningDto.setEqType(eqType);
busiEqmWarningDto.setGzType(gzType); busiEqmWarningDto.setGzType(gzType);

@ -61,7 +61,7 @@ public interface BusiHomePageService {
PageInfo<BusiHomePageWarningVo> findCurrentWarningBySensorCodeList(BusiEqmWarningDto busiEqmWarningDto); PageInfo<BusiHomePageWarningVo> findCurrentWarningBySensorCodeList(BusiEqmWarningDto busiEqmWarningDto);
public boolean verifyDongle() throws UnknownHostException; // public boolean verifyDongle() throws UnknownHostException;
/** /**
* *

@ -110,8 +110,8 @@ public class BusiHomePageServiceImpl implements BusiHomePageService {
@Autowired @Autowired
private BusiArresterSensorMapper busiArresterSensorMapper; private BusiArresterSensorMapper busiArresterSensorMapper;
@Value("${dangle.dat.path}") // @Value("${dangle.dat.path}")
private String danglePath; // private String danglePath;
@Value("${dangle.dat.ip}") @Value("${dangle.dat.ip}")
private String ip; private String ip;
@ -239,37 +239,37 @@ public class BusiHomePageServiceImpl implements BusiHomePageService {
return busiEqmWarningService.findCurrentWarningBySensorCodeList(busiEqmWarningDto); return busiEqmWarningService.findCurrentWarningBySensorCodeList(busiEqmWarningDto);
} }
@Override // @Override
public boolean verifyDongle() throws UnknownHostException { // public boolean verifyDongle() throws UnknownHostException {
String path=danglePath; // String path=danglePath;
File file = new File(path); // File file = new File(path);
List list = new ArrayList(); // List list = new ArrayList();
String sourse=""; // String sourse="";
if (file.exists()) { // if (file.exists()) {
try { // try {
//将文件的每行为一个元素添加到list中 // //将文件的每行为一个元素添加到list中
list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); // list = Files.readAllLines(file.toPath(), Charset.defaultCharset());
} catch (IOException ex) { // } catch (IOException ex) {
ex.printStackTrace(); // ex.printStackTrace();
} // }
if (list.isEmpty()){ // if (list.isEmpty()){
return false; // return false;
} // }
//
}else{ // }else{
return false; // return false;
} // }
for (Object line : list) { // for (Object line : list) {
sourse+=line; // sourse+=line;
} // }
String sourseNew = Md5Util.md5(Md5Util.DANGLE_CONTENT+ip+mac).toUpperCase(); // String sourseNew = Md5Util.md5(Md5Util.DANGLE_CONTENT+ip+mac).toUpperCase();
if(sourse.equals(sourseNew)){ // if(sourse.equals(sourseNew)){
return true; // return true;
}else{ // }else{
return false; // return false;
} // }
//
} // }
@Override @Override
public MeteorologicalVo queryMeteorologicalInfo() { public MeteorologicalVo queryMeteorologicalInfo() {

@ -52,8 +52,8 @@ import com.huatek.torch.util.uuid.Uuid;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class LoginServiceImpl implements LoginService { public class LoginServiceImpl implements LoginService {
@Value("${dangle.dat.path}") // @Value("${dangle.dat.path}")
private String danglePath; // private String danglePath;
@Value("${dangle.dat.ip}") @Value("${dangle.dat.ip}")
private String ip; private String ip;
@ -76,9 +76,9 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
public Map<String, Object> login(UserDTO user, long time, String tag, String code, boolean verify) throws Exception{ public Map<String, Object> login(UserDTO user, long time, String tag, String code, boolean verify) throws Exception{
if(!verifyDongle()){ // if(!verifyDongle()){
return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null); // return ResultUtil.put(Md5Util.DANGLE_CODE_FAIL, "", null);
} // }
ValueOperations<String, String> operations = redisTemplate.opsForValue(); ValueOperations<String, String> operations = redisTemplate.opsForValue();
if (verify) { if (verify) {
if (StringUtils.isEmpty(code)) { if (StringUtils.isEmpty(code)) {
@ -137,36 +137,36 @@ public class LoginServiceImpl implements LoginService {
return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", ""); return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", "");
} }
public boolean verifyDongle() throws UnknownHostException { // public boolean verifyDongle() throws UnknownHostException {
String path=danglePath; // String path=danglePath;
File file = new File(path); // File file = new File(path);
List list = new ArrayList(); // List list = new ArrayList();
String sourse=""; // String sourse="";
if (file.exists()) { // if (file.exists()) {
try { // try {
//将文件的每行为一个元素添加到list中 // //将文件的每行为一个元素添加到list中
list = Files.readAllLines(file.toPath(), Charset.defaultCharset()); // list = Files.readAllLines(file.toPath(), Charset.defaultCharset());
} catch (IOException ex) { // } catch (IOException ex) {
ex.printStackTrace(); // ex.printStackTrace();
} // }
if (list.isEmpty()){ // if (list.isEmpty()){
return false; // return false;
} // }
//
}else{ // }else{
return false; // return false;
} // }
for (Object line : list) { // for (Object line : list) {
sourse+=line; // sourse+=line;
} // }
String sourseNew =Md5Util.md5(Md5Util.DANGLE_CONTENT+ip+mac).toUpperCase(); // String sourseNew =Md5Util.md5(Md5Util.DANGLE_CONTENT+ip+mac).toUpperCase();
if(sourse.equals(sourseNew)){ // if(sourse.equals(sourseNew)){
return true; // return true;
}else{ // }else{
return false; // return false;
} // }
//
} // }
@Override @Override
public Map<String, Object> changePwd(String token, Map<String, String> map) { public Map<String, Object> changePwd(String token, Map<String, String> map) {
String oldPwd = map.get("oldPwd"); String oldPwd = map.get("oldPwd");

Loading…
Cancel
Save