Created
August 27, 2018 08:29
-
-
Save shestakow1993/f5f2982e86b17b10269ca8cecda50d1b to your computer and use it in GitHub Desktop.
my firs webservice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.Connection; | |
import java.util.Arrays; | |
import java.util.Calendar; | |
import java.util.List; | |
import javax.jws.WebService; | |
import bitel.billing.common.TimeUtils; | |
import bitel.billing.server.contract.bean.Contract; | |
import bitel.billing.server.contract.bean.ContractManager; | |
import bitel.billing.server.contract.bean.ContractParameterManager; | |
import bitel.billing.server.dialup.bean.CalculatePeriod; | |
import bitel.billing.server.dialup.bean.CalculatePeriodManager; | |
import ru.bitel.bgbilling.kernel.container.managed.ServerContext; | |
import ru.bitel.bgbilling.kernel.container.service.server.AbstractService; | |
@WebService(targetNamespace="testService") | |
public class TestCustomServiceImpl extends AbstractService implements TestCustomService { | |
private final int CONTRACT_PARAM_FIO = 2; | |
private final int CONTRACT_PARAM_ADDRESS = 1; | |
private final int DIALUP_MID =1; | |
@Override | |
public List<String> testMethod(int contractTitle) { | |
ServerContext context = ServerContext.get(); | |
Connection con = context.getConnection(); | |
ContractManager contractManager = new ContractManager(con); | |
if (contractTitle > 0) { | |
Contract contract = contractManager.getContractByTitle(String.valueOf(contractTitle)); | |
int cid = contract.getId(); | |
ContractParameterManager contractParameterManager = new ContractParameterManager(con); | |
StringBuilder userInfo = new StringBuilder(""); | |
userInfo.append("Договор: ").append(contract.getTitle()); | |
userInfo.append(", ФИО- ").append(contractParameterManager.getStringParam(cid, CONTRACT_PARAM_FIO)); | |
userInfo.append(" Адрес: ").append(contractParameterManager.getAddressParam(cid, CONTRACT_PARAM_ADDRESS).getAddress()); | |
CalculatePeriodManager calculatePeriodManager = new CalculatePeriodManager(con,DIALUP_MID); | |
List calculatePeriodList = calculatePeriodManager.getPeriodList(cid); | |
int size = calculatePeriodList.size(); | |
int id=-1; | |
Calendar date1=null; | |
Calendar date2=null; | |
CalculatePeriod calculatePeriod = (CalculatePeriod) calculatePeriodList.get(size-1); | |
id = calculatePeriod.getId(); | |
date1 = calculatePeriod.getStart(); | |
date2 = calculatePeriod.getEnd(); | |
String closeDate = "Дата закрытия: "+TimeUtils.convertCalendarToDateString(date2); | |
List<String> root = Arrays.asList(userInfo.toString(),closeDate); | |
return root; | |
} | |
return null; | |
} | |
} | |
#################################################################################### | |
import java.util.List; | |
import javax.jws.WebService; | |
@WebService | |
public interface TestCustomService | |
{ | |
public List<String> testMethod(int contractTitle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment