Commit e2f94b2d authored by Vu Duy Anh's avatar Vu Duy Anh

anhvd commit change

parent 32cf8c0c
...@@ -27,7 +27,7 @@ public class TimeRangeDialMode implements Serializable { ...@@ -27,7 +27,7 @@ public class TimeRangeDialMode implements Serializable {
@Column(name = "COMPANY_SITE_ID") @Column(name = "COMPANY_SITE_ID")
private Long companySiteId; private Long companySiteId;
@Temporal(TemporalType.DATE) @Temporal(TemporalType.TIMESTAMP)
@Column(name = "START_TIME") @Column(name = "START_TIME")
private Date startTime; private Date startTime;
......
package com.viettel.campaign.repository.ccms_full; package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.web.dto.ResultDTO; import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.UserActionLogDTO; import com.viettel.campaign.web.dto.UserActionLogDTO;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author anhvd_itsol * @author anhvd_itsol
*/ */
public interface UserActionLogRepositoryCustom { public interface UserActionLogRepositoryCustom {
@Transactional(DataSourceQualify.CCMS_FULL)
ResultDTO insertToUserActionLog(UserActionLogDTO userActionLogDTO); ResultDTO insertToUserActionLog(UserActionLogDTO userActionLogDTO);
} }
...@@ -44,4 +44,6 @@ public interface CampaignService { ...@@ -44,4 +44,6 @@ public interface CampaignService {
List<TimeRangeDialMode> getCampaignTimeRangeMode (Long campaignId, Long companySiteId); List<TimeRangeDialMode> getCampaignTimeRangeMode (Long campaignId, Long companySiteId);
List<TimeZoneDialMode> getCampaignTimeZoneMode (Long campaignId, Long companySiteId); List<TimeZoneDialMode> getCampaignTimeZoneMode (Long campaignId, Long companySiteId);
ResultDTO renewCampaign (CampaignDTO campaignDTO);
} }
...@@ -15,6 +15,7 @@ import com.viettel.campaign.utils.DataUtil; ...@@ -15,6 +15,7 @@ import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.utils.WorkBookBuilder; import com.viettel.campaign.utils.WorkBookBuilder;
import com.viettel.campaign.web.dto.*; import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO; import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import oracle.jdbc.driver.Const;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
...@@ -227,20 +228,14 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -227,20 +228,14 @@ public class CampaignServiceImpl implements CampaignService {
userActionLog.setObjectId(entity.getCampaignId()); userActionLog.setObjectId(entity.getCampaignId());
if (dto.getStatus().equals((short) -1)) { if (dto.getStatus().equals((short) -1)) {
userActionLog.setActionType((short) 2); userActionLog.setActionType((short) 2);
} } else if (dto.getStatus().equals((short) 1)) {
else if(dto.getStatus().equals((short) 4)) { userActionLog.setActionType((short) 3);
userActionLog.setActionType((short) 7); } else if (dto.getStatus().equals((short) 2)) {
} userActionLog.setActionType((short) 5);
else if(dto.getStatus().equals((short) 3)) { } else if (dto.getStatus().equals((short) 3)) {
userActionLog.setActionType((short) 4); userActionLog.setActionType((short) 4);
}
else if(dto.getStatus().equals((short) 2)) {
} else if (dto.getStatus().equals((short) 5)) {
userActionLog.setActionType((short) 7);
} else if (dto.getStatus().equals((short) 4)) { } else if (dto.getStatus().equals((short) 4)) {
userActionLog.setActionType((short) 4); userActionLog.setActionType((short) 7);
} else if (dto.getStatus().equals((short) 3)) {
userActionLog.setActionType((short) 5);
} }
userActionLogRepository.insertToUserActionLog(userActionLog); userActionLogRepository.insertToUserActionLog(userActionLog);
...@@ -275,7 +270,7 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -275,7 +270,7 @@ public class CampaignServiceImpl implements CampaignService {
XSSFWorkbook workbook = new XSSFWorkbook(); XSSFWorkbook workbook = new XSSFWorkbook();
Sheet sheet; Sheet sheet;
CellStyle styleTitle = WorkBookBuilder.buildDefaultStyleTitle(workbook); CellStyle styleTitle = WorkBookBuilder.buildDefaultStyleTitle(workbook);
CellStyle styleRowHeader = WorkBookBuilder.buildDefaultStyleRowHeader(workbook); CellStyle styleRowHeader = WorkBookBuilder.buildDefaultStyleRowHeader(workbook);
CellStyle styleRow = WorkBookBuilder.buildDefaultStyleRow(workbook); CellStyle styleRow = WorkBookBuilder.buildDefaultStyleRow(workbook);
...@@ -339,15 +334,53 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -339,15 +334,53 @@ public class CampaignServiceImpl implements CampaignService {
} }
@Override @Override
@Transactional(DataSourceQualify.CCMS_FULL)
public List<TimeRangeDialMode> getCampaignTimeRangeMode(Long campaignId, Long companySiteId) { public List<TimeRangeDialMode> getCampaignTimeRangeMode(Long campaignId, Long companySiteId) {
return timeRangeDialModeRepository.findTimeRangeDialModeByCampaignIdAndCompanySiteId(campaignId, companySiteId); return timeRangeDialModeRepository.findTimeRangeDialModeByCampaignIdAndCompanySiteId(campaignId, companySiteId);
} }
@Override @Override
@Transactional(DataSourceQualify.CCMS_FULL)
public List<TimeZoneDialMode> getCampaignTimeZoneMode(Long campaignId, Long companySiteId) { public List<TimeZoneDialMode> getCampaignTimeZoneMode(Long campaignId, Long companySiteId) {
return timeZoneDialModeRepository.findTimeZoneDialModeByCampaignIdAndCompanySiteId(campaignId, companySiteId); return timeZoneDialModeRepository.findTimeZoneDialModeByCampaignIdAndCompanySiteId(campaignId, companySiteId);
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO renewCampaign(CampaignDTO campaignDTO) {
ResultDTO resultDTO = new ResultDTO();
try {
Campaign entity = campaignRepository.findCampaignByCampaignIdAndCompanySiteId(campaignDTO.getCampaignId(), campaignDTO.getCompanySiteId());
if (entity != null) {
entity.setStatus(campaignDTO.getStatus().longValue());
entity.setUpdateTime(new Date());
entity.setUpdateBy(campaignDTO.getUpdateBy());
entity.setEndTime(campaignDTO.getEndTime());
campaignRepository.save(entity);
UserActionLogDTO userActionLog = new UserActionLogDTO();
userActionLog.setAgentId(null);
userActionLog.setSessionId(campaignDTO.getSessionId());
userActionLog.setCompanySiteId(campaignDTO.getCompanySiteId());
userActionLog.setDescription(null);
userActionLog.setStartTime(new Date());
userActionLog.setEndTime(null);
userActionLog.setObjectId(entity.getCampaignId());
userActionLog.setActionType((short) 6);
userActionLogRepository.insertToUserActionLog(userActionLog);
resultDTO.setData(entity);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
private String generateCampaignCode(String campaignType, Short chanel) { private String generateCampaignCode(String campaignType, Short chanel) {
int year = Calendar.getInstance().get(Calendar.YEAR); int year = Calendar.getInstance().get(Calendar.YEAR);
String maxIndexStr = campaignRepositoryCustom.getMaxCampaignIndex(); String maxIndexStr = campaignRepositoryCustom.getMaxCampaignIndex();
...@@ -361,9 +394,9 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -361,9 +394,9 @@ public class CampaignServiceImpl implements CampaignService {
public String getCampaignTypeName(List<ApParam> lstApParams, String type) { public String getCampaignTypeName(List<ApParam> lstApParams, String type) {
String name = ""; String name = "";
if(!DataUtil.isNullOrEmpty(type)) { if (!DataUtil.isNullOrEmpty(type)) {
for(int i = 0; i < lstApParams.size(); i++) { for (int i = 0; i < lstApParams.size(); i++) {
if(type.equals(lstApParams.get(i).getParValue())) { if (type.equals(lstApParams.get(i).getParValue())) {
name = lstApParams.get(i).getParName(); name = lstApParams.get(i).getParName();
break; break;
} }
......
...@@ -175,4 +175,10 @@ public class CampaignController { ...@@ -175,4 +175,10 @@ public class CampaignController {
return timeZoneDialModeRepository.findTimeZoneDialModeByCampaignIdAndCompanySiteId(campaignId, companySiteId); return timeZoneDialModeRepository.findTimeZoneDialModeByCampaignIdAndCompanySiteId(campaignId, companySiteId);
} }
@RequestMapping(value = "/renewCampaign", method = RequestMethod.PUT)
public ResponseEntity<ResultDTO> renewCampaign(@RequestBody CampaignDTO campaignDTO) {
ResultDTO result = campaignService.renewCampaign(campaignDTO);
return new ResponseEntity<>(result, HttpStatus.OK);
}
} }
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