Commit 9c669b8f authored by đinh thị đầm's avatar đinh thị đầm

edit with campaignCompleteCodeId

parent 164e813f
......@@ -29,4 +29,6 @@ public interface CampaignCompleteCodeService {
ResultDTO getListStatusWithoutType(String completeValue, Short completeType, Long companySiteId);
ResultDTO editCampaignCompleteCode (Long campaignCompleteCodeId);
}
......@@ -57,7 +57,6 @@ public interface CustomerService {
ResultDTO getCustomerRecall(Long campaignId, Long customerId);
List<Customer> findAllByCondition(Long siteId, Date endTime);
Customer update(Customer c);
......
......@@ -325,4 +325,61 @@ public class CampaignCompleteCodeServiceImpl implements CampaignCompleteCodeServ
return resultDTO;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO editCampaignCompleteCode(Long campaignCompleteCodeId) {
ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
if (DataUtil.isNullOrZero(campaignCompleteCodeId)) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
return resultDTO;
}
try {
StringBuilder sqlStrBuilder = new StringBuilder();
sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_STATUS_MNG,"findCampaignCodeById"));
SQLQuery query = session.createSQLQuery(sqlStrBuilder.toString());
query.setParameter("p_campaignComleteCode",campaignCompleteCodeId);
query.addScalar("campaignCompleteCodeId", new LongType());
query.addScalar("campaignId", new LongType());
query.addScalar("completeName", new StringType());
query.addScalar("completeValue", new StringType());
query.addScalar("description", new StringType());
query.addScalar("status", new ShortType());
query.addScalar("completeType", new ShortType());
query.addScalar("isRecall", new ShortType());
query.addScalar("updateAt", new DateType());
query.addScalar("updateBy", new StringType());
query.addScalar("createBy", new StringType());
query.addScalar("createAt", new DateType());
query.addScalar("campaignType", new StringType());
query.addScalar("isFinish", new ShortType());
query.addScalar("isLock", new ShortType());
query.addScalar("companySiteId", new LongType());
query.addScalar("durationLock", new LongType());
query.addScalar("chanel", new LongType());
query.setResultTransformer(Transformers.aliasToBean(CampaignCompleteCodeDTO.class));
List<CampaignCompleteCodeDTO>data = query.list();
resultDTO.setData(data);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
logger.error(e.getMessage(), e);
} finally {
session.close();
}
return resultDTO;
}
}
......@@ -58,7 +58,8 @@ public class CampaignCompleteCodeController {
@PostMapping("/update")
@ResponseBody
public ResultDTO updateCompleteCode(@RequestBody @Valid CampaignCompleteCodeDTO completeCodeDTO) {
public ResultDTO updateCompleteCode(@RequestBody @Valid CampaignCompleteCodeDTO completeCodeDTO
) {
ResultDTO result = new ResultDTO();
try {
result = completeCodeService.updateCompleteCode(completeCodeDTO);
......@@ -70,6 +71,18 @@ public class CampaignCompleteCodeController {
}
return result;
}
@GetMapping("/edit")
@ResponseBody
public ResultDTO findCampaignCodeById(@RequestParam("campaignCompleteCodeId") Long campaignCompleteCodeId){
ResultDTO resultDTO = new ResultDTO();
try{
resultDTO = completeCodeService.editCampaignCompleteCode(campaignCompleteCodeId);
}catch (Exception e){
resultDTO.setErrorCode("-1");
LOGGER.error(e);
}
return resultDTO;
}
@PostMapping("/delete")
@ResponseBody
......
......@@ -242,12 +242,12 @@ public class CustomerController {
}
}
@RequestMapping(value = "/searchCustomerListInfoFromCustomerList", method = RequestMethod.GET)
public ResultDTO searchCustomerListInfoFromCustomerList(@RequestParam("page") int page,
@RequestParam("pageSize") int pageSize,
@RequestParam("sort") String sort,
@RequestParam("campaignId") Long campaignId,
@RequestParam("companySiteId") Long companySiteId) {
return customerService.searchCustomerListInfoFromCustomerList(page, pageSize, sort, campaignId, companySiteId);
}
// @RequestMapping(value = "/searchCustomerListInfoFromCustomerList", method = RequestMethod.GET)
// public ResultDTO searchCustomerListInfoFromCustomerList(@RequestParam("page") int page,
// @RequestParam("pageSize") int pageSize,
// @RequestParam("sort") String sort,
// @RequestParam("campaignId") Long campaignId,
// @RequestParam("companySiteId") Long companySiteId) {
// return customerService.searchCustomerListInfoFromCustomerList(page, pageSize, sort, campaignId, companySiteId);
// }
}
SELECT CAMPAIGN_COMPLETE_CODE_ID campaignCompleteCodeId,
IS_RECALL isRecall ,
CAMPAIGN_ID campaignId,
COMPLETE_VALUE completeValue,
COMPLETE_NAME completeName,
COMPLETE_TYPE completeType,
CAMPAIGN_TYPE campaignType,
DESCRIPTION description,
STATUS status,
COMPANY_SITE_ID companySiteId,
UPDATE_BY updateBy ,
UPDATE_AT updateAt,
CREATE_BY createBy,
CREATE_AT createAt,
IS_FINISH isFinish,
IS_LOCK isLock,
DURATION_LOCK durationLock,
CHANEL chanel
from CAMPAIGN_COMPLETE_CODE WHERE CAMPAIGN_COMPLETE_CODE_ID=:p_campaignComleteCode
SELECT max(COMPLETE_VALUE) completeValue, COMPANY_SITE_ID companySiteId from CAMPAIGN_COMPLETE_CODE where COMPANY_SITE_ID = :p_site_id GROUP BY COMPANY_SITE_ID
SELECT max(to_number(COMPLETE_VALUE)) completeValue, COMPANY_SITE_ID companySiteId from CAMPAIGN_COMPLETE_CODE where COMPANY_SITE_ID = :p_site_id GROUP BY COMPANY_SITE_ID
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