Commit 1a24ad02 authored by renjie's avatar renjie

Merge branch 'dev-zrj' into 'staging'

共有ip修改

See merge request !140
parents 70d76bbd 05214ea1
......@@ -3,8 +3,10 @@ package com.edgec.browserbackend.browser.controller;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.dto.*;
import com.edgec.browserbackend.browser.service.IpResourceService;
import com.edgec.browserbackend.common.auth.Securitys;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -183,4 +185,21 @@ public class IpControlloer {
}
return resultDto;
}
@RequestMapping(value = "/transferbindshops", method = RequestMethod.PUT)
@PreAuthorize(Securitys.ADMIN_EL)
public ResultDto transferBindShops(Principal principal) {
ResultDto resultDto = new ResultDto();
try {
ipResourceService.transferBindShops();
resultDto.setStatus(0);
} catch (Exception e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", 80001);
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
}
return resultDto;
}
}
......@@ -42,6 +42,7 @@ public class IpResource implements Serializable {
private String proxyUsername; //专线的代理用户名
private String proxyPassword; //专线的代理密码
private String shopId;
private List<String> shopIds = new ArrayList<>();
private boolean bind;
......@@ -302,4 +303,12 @@ public class IpResource implements Serializable {
public void setBind(boolean bind) {
this.bind = bind;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
}
......@@ -840,4 +840,13 @@ public class IpResourceServiceImpl implements IpResourceService {
DeleteIpResultDto deleteIpResultDto = JSON.parseObject(result.getBody(), DeleteIpResultDto.class);
});
}
@Override
public void transferBindShops() {
List<IpResource> ipResources = ipResourceRepository.findByIsDeleted(false);
for (IpResource ipResource : ipResources) {
ipResourceRepository.addShopId(ipResource.getId(), ipResource.getShopId());
ipResourceRepository.updateBind(ipResource.getId(), true);
}
}
}
......@@ -32,4 +32,6 @@ public interface IpResourceService {
void setSpecialLine();
void releaseDeletedIp();
void transferBindShops();
}
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