Commit 63ddc8fc authored by Nguyen Ha's avatar Nguyen Ha

fix sonar

parent adbc0add
......@@ -24,6 +24,9 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -33,6 +36,8 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
private static final Logger logger = LoggerFactory.getLogger(CampaignExecuteServiceImp.class);
private SimpleDateFormat formatter = new SimpleDateFormat(Constants.DATE_FORMAT.FOMART_DATE_TYPE_1);
private Random rand = SecureRandom.getInstanceStrong();
@Autowired
ModelMapper modelMapper;
......@@ -66,6 +71,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Autowired
CampaignCustomerListColumnRepository campaignCustomerListColumnRepository;
public CampaignExecuteServiceImp() throws NoSuchAlgorithmException {
}
//<editor-fold: hungtt>
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
......@@ -119,14 +127,15 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) {
public XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException {
Locale locale = Locale.forLanguageTag("vi");
List<ContactCustResultDTO> list = campaignExecuteRepository.getExcelInteractiveResult(dto);
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFWorkbook workbook = null;
Sheet sheet;
try {
// create font style
workbook = new XSSFWorkbook();
Font defaultFont = workbook.createFont();
defaultFont.setFontHeightInPoints((short) 13);
defaultFont.setFontName("Times New Roman");
......@@ -217,6 +226,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
++rowIndex;
++count;
}
}catch (Exception e){
}finally {
if (workbook != null) workbook.close();
}
return workbook;
}
......@@ -493,13 +508,13 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override
public ResultDTO getCallStatus(CampaignRequestDTO dto) {
ResultDTO result = new ResultDTO();
Random r = new Random();
// Random r = new Random();
String[] arr = {"ACCEPT", "REJECT", "MISSING"};
if (dto != null) {
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(arr[r.nextInt(arr.length)]);
result.setData(arr[this.rand.nextInt(arr.length)]);
} else {
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR);
......
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