Commit 14120134 authored by Nguyen Ha's avatar Nguyen Ha

fix sonar

parent b688345d
...@@ -19,7 +19,7 @@ import java.util.List; ...@@ -19,7 +19,7 @@ import java.util.List;
@Slf4j @Slf4j
public class CampaignJob { public class CampaignJob {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); private SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
private static final String CUSTOMER_INACTIVE_DUARATION = "CUSTOMER_INACTIVE_DUARATION"; private static final String CUSTOMER_INACTIVE_DUARATION = "CUSTOMER_INACTIVE_DUARATION";
private static final String CRON_EXPRESSION_CHECK_START = "CRON_EXPRESSION_CHECK_START"; private static final String CRON_EXPRESSION_CHECK_START = "CRON_EXPRESSION_CHECK_START";
private static final String CRON_EXPRESSION_CHECK_END = "CRON_EXPRESSION_CHECK_END"; private static final String CRON_EXPRESSION_CHECK_END = "CRON_EXPRESSION_CHECK_END";
......
...@@ -15,7 +15,7 @@ import java.util.Date; ...@@ -15,7 +15,7 @@ import java.util.Date;
public class CustomerContact implements Serializable { public class CustomerContact implements Serializable {
@Id @Id
@Basic(optional = false) @Basic(optional = false)
@GeneratedValue(generator = "customer_contact_seq", strategy = GenerationType.IDENTITY) @GeneratedValue(generator = "customer_contact_seq")
@SequenceGenerator(name = "customer_contact_seq", sequenceName = "customer_contact_seq", allocationSize = 1) @SequenceGenerator(name = "customer_contact_seq", sequenceName = "customer_contact_seq", allocationSize = 1)
@NotNull @NotNull
@Column(name = "CONTACT_ID") @Column(name = "CONTACT_ID")
......
package com.viettel.campaign.model.ccms_full; package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -67,8 +64,10 @@ public class CustomizeFields implements Serializable { ...@@ -67,8 +64,10 @@ public class CustomizeFields implements Serializable {
@Column(name = "ACTIVE") @Column(name = "ACTIVE")
private Long active; private Long active;
public CustomizeFields(String type, String title) { public CustomizeFields(@NotNull String type, @NotNull String title) {
this.type = type; this.type = type;
this.title = title; this.title = title;
} }
} }
...@@ -301,9 +301,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -301,9 +301,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
if (!"AGENT".equals(dto.getRoleUser())) { // ko phải nhân viên if (!"AGENT".equals(dto.getRoleUser())) { // ko phải nhân viên
ContactCustResultDTO.setEnableEdit(true); ContactCustResultDTO.setEnableEdit(true);
} else { } else {
if ("2".equals(ContactCustResultDTO.getRecordStatus())) {// là nhân viên thường if (2 == ContactCustResultDTO.getRecordStatus()) {// là nhân viên thường
ContactCustResultDTO.setEnableEdit(true); ContactCustResultDTO.setEnableEdit(true);
} else if ("1".equals(ContactCustResultDTO.getRecordStatus()) && isLower24Hour(ContactCustResultDTO.getCreateTime())) { } else if (1 == ContactCustResultDTO.getRecordStatus() && isLower24Hour(ContactCustResultDTO.getCreateTime())) {
ContactCustResultDTO.setEnableEdit(true); ContactCustResultDTO.setEnableEdit(true);
} else { } else {
ContactCustResultDTO.setEnableEdit(false); ContactCustResultDTO.setEnableEdit(false);
...@@ -439,8 +439,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -439,8 +439,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} finally { } finally {
session.close(); session.close();
return list;
} }
return list;
} }
@Override @Override
......
...@@ -57,8 +57,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -57,8 +57,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
ResultDTO result = new ResultDTO(); ResultDTO result = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = null;
session.beginTransaction();
if (DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) { if (DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) {
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
...@@ -66,6 +65,9 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -66,6 +65,9 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return result; return result;
} }
try { try {
session = sessionFactory.openSession();
session.beginTransaction();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" SELECT"); sb.append(" SELECT");
...@@ -256,8 +258,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -256,8 +258,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
logger.error(ex.getMessage(), ex); logger.error(ex.getMessage(), ex);
} finally { } finally {
if(null != session) {
session.close(); session.close();
} }
}
return result; return result;
} }
...@@ -267,8 +271,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -267,8 +271,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
ResultDTO result = new ResultDTO(); ResultDTO result = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = null;
session.beginTransaction();
if (DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) { if (DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) {
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
...@@ -276,6 +279,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -276,6 +279,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return result; return result;
} }
try { try {
session = sessionFactory.openSession();
session.beginTransaction();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
// sb.append(" SELECT CAMPAIGN_ID campaignId, " + // sb.append(" SELECT CAMPAIGN_ID campaignId, " +
// " CAMPAIGN_CODE campaignCode, " + // " CAMPAIGN_CODE campaignCode, " +
...@@ -343,7 +348,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -343,7 +348,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} finally { } finally {
session.close(); if(session != null) session.close();
} }
return result; return result;
} }
...@@ -353,9 +358,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -353,9 +358,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
logger.info("Start search max campaign code index::"); logger.info("Start search max campaign code index::");
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = null;
session.beginTransaction();
try { try {
session = sessionFactory.openSession();
session.beginTransaction();
//StringBuilder sb = new StringBuilder(); //StringBuilder sb = new StringBuilder();
//sb.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-max-campaign-code-index")); //sb.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-max-campaign-code-index"));
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -373,6 +379,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -373,6 +379,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
} }
} catch (Exception ex) { } catch (Exception ex) {
logger.error(ex.getMessage(), ex); logger.error(ex.getMessage(), ex);
}finally {
if(session != null) session.close();
} }
return null; return null;
} }
...@@ -779,8 +787,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -779,8 +787,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} finally { } finally {
session.close(); session.close();
return resultDTO;
} }
return resultDTO;
} }
@Override @Override
......
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