Commit 013f9821 authored by Đào Nhật Quang's avatar Đào Nhật Quang

quangdn

parent 89da29ea
......@@ -18,4 +18,6 @@ public interface CampaignRepository extends JpaRepository<Campaign, Long>, Campa
" AND cc.recallTime <= sysdate " +
" AND cc.agentId = :pAgentId")
Long countRecallCustomer(@Param("pCompanySiteId") Long pCompanySiteId, @Param("pAgentId") Long pAgentId);
Campaign findCampaignByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
......@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityNotFoundException;
import java.util.*;
@Service
......@@ -123,14 +124,11 @@ public class CampaignServiceImpl implements CampaignService {
public ResultDTO changeCampaignStatus(CampaignDTO dto) {
ResultDTO result = new ResultDTO();
try {
Optional<Campaign> campaign = campaignRepository.findById(dto.getCampaignId());
if (campaign.isPresent()) {
Campaign entity = campaign.get();
Campaign entity = campaignRepository.findCampaignByCampaignIdAndCompanySiteId(dto.getCampaignId(), dto.getCompanySiteId());
if (entity != null) {
entity.setStatus(dto.getStatus().longValue());
entity.setUpdateTime(new Date());
entity.setUpdateBy(dto.getUpdateBy());
entity.setCampaignId(dto.getCampaignId());
entity.setCompanySiteId(dto.getCompanySiteId());
campaignRepository.save(entity);
result.setData(entity);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
......
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