Commit a0405b6f authored by renjie's avatar renjie

1.ip添加专线字段

2.提现bug
parent 5a80bad5
......@@ -461,7 +461,7 @@ public class AccountController {
}
@RequestMapping(path = "/ali/withdraw", method = RequestMethod.PUT)
public ResultDto alipayWithdraw(Principal principal, @RequestParam("account") String account, @RequestParam("realName") String realName, @RequestParam("amount") int amount) {
public ResultDto alipayWithdraw(Principal principal, @RequestParam("account") String account, @RequestParam("realName") String realName, @RequestParam("amount") double amount) {
// //获取支付宝GET过来反馈信息
// Map<String,String> params = new HashMap<String,String>();
// Map requestParams = request.getParameterMap();
......
......@@ -181,7 +181,7 @@ public class AdministratorController {
//查询某时段内增加的用户
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(path ="/0xadministrator/searchperioduser",method = RequestMethod.GET)
public Page<Account> searchCreateAccount(@RequestParam(value="page") int page, @RequestParam(value="size") int size, @RequestParam(value="strDate1") String strDate1, @RequestParam(value="strDate2") String strDate2, @RequestParam("isAuthorized") boolean isAuthorized ){
public Page<Account> searchCreateAccount(@RequestParam(value="page") int page, @RequestParam(value="size") int size, @RequestParam(value="strDate1") String strDate1, @RequestParam(value="strDate2") String strDate2, @RequestParam(value = "isAuthorized", defaultValue = "5") int isAuthorized ){
Pageable pageable = PageRequest.of(page, size);
return administratorService.searchCreateAccountBetween(pageable,strDate1,strDate2,isAuthorized);
}
......
......@@ -35,7 +35,7 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
Page<Account> findAllBySignupDateBetweenAndParentIsNull(Pageable pageable, Date startDate, Date endDate);
Page<Account> findAllBySignupDateBetweenAndParentIsNullAndAuthorizedNot(Pageable pageable, Date startDate, Date endDate, int authorized);
Page<Account> findAllBySignupDateBetweenAndParentIsNullAndAuthorized(Pageable pageable, Date startDate, Date endDate, int authorized);
Page<Account> findAll(Pageable pageable);
......
......@@ -8,8 +8,6 @@ public interface AccountRepositoryCustom {
List<String> findInName(String[] name);
List<String> findParents(List<String> names);
void updateRealNameAndIdCard(String username, String realName, String idCard);
Account findByPromotion(String code);
......
......@@ -9,7 +9,6 @@ import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.MatchOperation;
import org.springframework.data.mongodb.core.aggregation.ProjectionOperation;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Update;
import java.util.ArrayList;
......@@ -42,19 +41,6 @@ public class AccountRepositoryCustomImpl implements AccountRepositoryCustom {
return accountTelephones;
}
@Override
public List<String> findParents(List<String> names) {
Document query = new Document();
Document fields = new Document();
fields.put("name", 1);
BasicQuery basicQuery = new BasicQuery(query, fields);
Criteria criteria = new Criteria();
basicQuery.addCriteria(criteria.orOperator(where("name").in(names)));
return null;
}
@Override
public void updateRealNameAndIdCard(String username, String realName, String idCard) {
Document doc = new Document();
......
......@@ -38,7 +38,7 @@ public interface AdministratorService {
Page<UserPrePaidBilling> searchAllUserBillingPage(int page, int year1, int month1, int year2, int month2);
Page<Account> searchCreateAccountBetween(Pageable pageable, String strDate1, String strDate2, boolean isAuthorized);
Page<Account> searchCreateAccountBetween(Pageable pageable, String strDate1, String strDate2, int isAuthorized);
List<UserPrePaidBilling> getServiceFeeOwedUserInfo();
......
......@@ -22,7 +22,7 @@ public interface PaymentService {
UserPaymentDto h5wxPayOrder(String ip, String username, int amount);
boolean alipayWithdraw(String username, String account, String realName, int amount);
boolean alipayWithdraw(String username, String account, String realName, double amount);
public UserPaymentDto wxCheckOrderStatus(String tradeno);
......
......@@ -225,16 +225,16 @@ public class AdministratorServiceImpl implements AdministratorService {
}
@Override
public Page<Account> searchCreateAccountBetween(Pageable pageable, String strDate1, String strDate2, boolean isAuthorized ) {
public Page<Account> searchCreateAccountBetween(Pageable pageable, String strDate1, String strDate2, int isAuthorized ) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Page<Account> accounts = null;
try {
Date dateTime1 = formatter.parse(strDate1);
Date dateTime2 = formatter.parse(strDate2);
if (isAuthorized)
accounts = accountRepository.findAllBySignupDateBetweenAndParentIsNullAndAuthorizedNot(pageable, dateTime1, dateTime2, 0);
else
if (isAuthorized == 5)
accounts = accountRepository.findAllBySignupDateBetweenAndParentIsNull(pageable, dateTime1, dateTime2);
else
accounts = accountRepository.findAllBySignupDateBetweenAndParentIsNullAndAuthorized(pageable, dateTime1, dateTime2, isAuthorized);
}catch (ParseException e){
e.printStackTrace();
}
......
......@@ -590,7 +590,7 @@ public class PaymentServiceImpl implements PaymentService {
}
@Override
public boolean alipayWithdraw(String username, String account, String realName, int amount) {
public boolean alipayWithdraw(String username, String account, String realName, double amount) {
Account byName = accountService.findByName(username);
if (byName == null)
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST, "account does not exist: " + username);
......
......@@ -36,8 +36,12 @@ public class IpResource implements Serializable {
private String password;
private double price;
private boolean specialLine;
//专线数据
private String proxyUsername;
private String proxyPassword;
private String proxyprotocol;
private String proxyport;
private String shopId;
private String shopName;
......@@ -48,7 +52,8 @@ public class IpResource implements Serializable {
private String unit;
private int period;
private boolean specialLine;
public IpResource() {
}
public String getDetails() {
return details;
......@@ -281,4 +286,21 @@ public class IpResource implements Serializable {
public void setSpecialLine(boolean specialLine) {
this.specialLine = specialLine;
}
public String getProxyport() {
return proxyport;
}
public void setProxyport(String proxyport) {
this.proxyport = proxyport;
}
public String getProxyprotocol() {
return proxyprotocol;
}
public void setProxyprotocol(String proxyprotocol) {
this.proxyprotocol = proxyprotocol;
}
}
......@@ -24,6 +24,13 @@ public class IpResourceDto {
ShopDto bindShop;
private List<BindHistory> bindHistories;
private boolean specialLine;
//专线数据
private String proxyUsername;
private String proxyPassword;
private String proxyprotocol;
private String proxyport;
public IpResourceDto(){
}
......@@ -40,6 +47,11 @@ public class IpResourceDto {
this.details = ipResource.getDetails();
this.password = ipResource.getPassword();
this.protocol = ipResource.getProtocol();
this.proxyUsername = ipResource.getProxyUsername();
this.proxyPassword = ipResource.getProxyPassword();
this.proxyport = ipResource.getProxyport();
this.proxyprotocol = ipResource.getProxyprotocol();
this.specialLine = ipResource.isSpecialLine();
this.bindShop = shopDto;
if (useHistory)
this.bindHistories = ipResource.getBindHistory();
......@@ -158,4 +170,44 @@ public class IpResourceDto {
public void setBindHistories(List<BindHistory> bindHistories) {
this.bindHistories = bindHistories;
}
public String getProxyPassword() {
return proxyPassword;
}
public void setProxyPassword(String proxyPassword) {
this.proxyPassword = proxyPassword;
}
public String getProxyUsername() {
return proxyUsername;
}
public void setProxyUsername(String proxyUsername) {
this.proxyUsername = proxyUsername;
}
public boolean isSpecialLine() {
return specialLine;
}
public void setSpecialLine(boolean specialLine) {
this.specialLine = specialLine;
}
public String getProxyport() {
return proxyport;
}
public void setProxyport(String proxyport) {
this.proxyport = proxyport;
}
public String getProxyprotocol() {
return proxyprotocol;
}
public void setProxyprotocol(String proxyprotocol) {
this.proxyprotocol = proxyprotocol;
}
}
package com.edgec.browserbackend.browser.task;
import com.edgec.browserbackend.account.repository.AccountRepository;
import com.edgec.browserbackend.auth.domain.mongo.MongoOAuth2AccessToken;
import com.edgec.browserbackend.auth.repository.mongo.MongoOAuth2AccessTokenRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.FileInputStream;
import java.time.Instant;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class Set3proxyTask {
private static final Logger log = LoggerFactory.getLogger(Set3proxyTask.class);
@Autowired
private AccountRepository accountRepository;
@Autowired
private MongoOAuth2AccessTokenRepository mongoOAuth2AccessTokenRepository;
// @Scheduled(cron = "0 0/1 * * * ?")
// public void set3proxy() {
// long validTime = Instant.now().minusSeconds(43200).toEpochMilli();
// List<String> tokenUsernames = mongoOAuth2AccessTokenRepository.findByCreatedAtGreaterThan(validTime).stream().map(MongoOAuth2AccessToken::getUsername).collect(Collectors.toList());
// List<String> accountParentDtos = accountRepository.findByNameIn(tokenUsernames).stream().map(x -> x.getParent() == null ? x.getName() : x.getParent()).distinct().collect(Collectors.toList());
//// FileInputStream fileInputStream = new FileInputStream();
// }
}
......@@ -72,6 +72,7 @@ public class RemoteShellExecutor {
out = new PrintWriter(new OutputStreamWriter(session.getStdin(),
"UTF-8"));
out.println(command);
System.out.println(command);
out.flush();
} finally {
if (null != out) {
......@@ -231,14 +232,19 @@ public class RemoteShellExecutor {
throw new RuntimeException(localFile + " is not a file");
}
String fileName = file.getName();
System.out.println(fileName);
InputStream stdOut = null;
InputStream stdErr = null;
String outStr = "";
String outErr = "";
try {
if (login()) {
Session session = conn.openSession();
session.startShell();
stdOut = new StreamGobbler(session.getStdout());
stdErr = new StreamGobbler(session.getStderr());
BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdOut));
BufferedReader stderrReader = new BufferedReader(new InputStreamReader(stdErr));
executeCommand("mkdir -p " + remoteTargetDirectory, session);
} catch (Exception e) {
throw new Exception("登录远程机器失败" + ip);
}
SCPClient sCPClient = conn.createSCPClient();
SCPOutputStream scpOutputStream = sCPClient.put(fileName, file.length(), remoteTargetDirectory, "0600");
......@@ -247,6 +253,38 @@ public class RemoteShellExecutor {
scpOutputStream.flush();
scpOutputStream.close();
session.waitForCondition(ChannelCondition.CLOSED | ChannelCondition.EOF | ChannelCondition.EXIT_STATUS , 30000);
logger.error("Here is the output from stdout:");
while (true)
{
String line = stdoutReader.readLine();
if (line == null)
break;
System.out.println(line);
}
logger.error("Here is the output from stderr:");
while (true)
{
String line = stderrReader.readLine();
if (line == null)
break;
System.out.println(line);
}
/* Show exit status, if available (otherwise "null") */
logger.error("ExitCode: " + session.getExitStatus());
session.close();/* Close this session */
conn.close();/* Close the connection */
}
} catch (IOException e) {
logger.error(e.getMessage());
throw new Exception("登录远程机器失败" + ip);
}finally {
if (conn != null) {
conn.close();
}
IOUtils.closeQuietly(stdOut);
IOUtils.closeQuietly(stdErr);
}
}
......@@ -281,8 +319,8 @@ public class RemoteShellExecutor {
}
public static void main(String args[]) throws Exception {
RemoteShellExecutor executor = new RemoteShellExecutor("120.25.233.237", "root", "5t8EsTuDH00uaA1");
RemoteShellExecutor executor = new RemoteShellExecutor("47.112.253.229", "root", "hIB4EbOcnkF5aA1");
executor.transferFile("3proxy.cfg", "/root");
// executor.execCommand("cd /root && sh restart.sh");
executor.execCommand("cd /root && sh restart.sh");
}
}
\ No newline at end of file
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