| Line 26... |
Line 26... |
| 26 |
import org.springframework.beans.factory.annotation.Autowired;
|
26 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 27 |
import org.springframework.beans.factory.annotation.Qualifier;
|
27 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 28 |
import org.springframework.cache.annotation.Cacheable;
|
28 |
import org.springframework.cache.annotation.Cacheable;
|
| 29 |
import org.springframework.stereotype.Component;
|
29 |
import org.springframework.stereotype.Component;
|
| 30 |
|
30 |
|
| - |
|
31 |
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
|
| 31 |
import com.mysql.fabric.xmlrpc.base.Array;
|
32 |
import com.mysql.fabric.xmlrpc.base.Array;
|
| 32 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
33 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
| 33 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
34 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 34 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
35 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 35 |
import com.spice.profitmandi.common.model.SchemeModel;
|
36 |
import com.spice.profitmandi.common.model.SchemeModel;
|
| Line 824... |
Line 825... |
| 824 |
* }
|
825 |
* }
|
| 825 |
*/
|
826 |
*/
|
| 826 |
|
827 |
|
| 827 |
@Override
|
828 |
@Override
|
| 828 |
public List<Scheme> selectSchemeByPartnerType(PartnerType partnerType, int itemId, boolean isAdmin, int offset,
|
829 |
public List<Scheme> selectSchemeByPartnerType(PartnerType partnerType, int itemId, boolean isAdmin, int offset,
|
| 829 |
int limit) {
|
830 |
int limit) throws ProfitMandiBusinessException {
|
| 830 |
Session session = sessionFactory.getCurrentSession();
|
831 |
Session session = sessionFactory.getCurrentSession();
|
| 831 |
CriteriaBuilder cb = session.getCriteriaBuilder();
|
832 |
CriteriaBuilder cb = session.getCriteriaBuilder();
|
| 832 |
CriteriaQuery<Scheme> query = cb.createQuery(Scheme.class);
|
833 |
CriteriaQuery<Scheme> query = cb.createQuery(Scheme.class);
|
| 833 |
Root<Scheme> scheme = query.from(Scheme.class);
|
834 |
Root<Scheme> scheme = query.from(Scheme.class);
|
| 834 |
List<PartnerType> pt = new ArrayList<>();
|
835 |
List<PartnerType> pt = new ArrayList<>();
|
| Line 839... |
Line 840... |
| 839 |
cb.desc(cb.isNull(scheme.get("expireTimestamp")));
|
840 |
cb.desc(cb.isNull(scheme.get("expireTimestamp")));
|
| 840 |
|
841 |
|
| 841 |
Predicate p3 = null;
|
842 |
Predicate p3 = null;
|
| 842 |
Predicate finalPredicate = null;
|
843 |
Predicate finalPredicate = null;
|
| 843 |
if (itemId != 0) {
|
844 |
if (itemId != 0) {
|
| - |
|
845 |
|
| 844 |
List<Integer> schemeIds = schemeItemRepository.selectSchemeIdByItemId(itemId);
|
846 |
List<Integer> schemeIds = schemeItemRepository.selectSchemeIdByItemId(itemId);
|
| - |
|
847 |
LOGGER.info("schemeId" + schemeIds);
|
| - |
|
848 |
if(schemeIds.isEmpty()) {
|
| - |
|
849 |
return new ArrayList<>();
|
| - |
|
850 |
}
|
| 845 |
p3 = cb.in(scheme.get("id")).value(schemeIds);
|
851 |
p3 = cb.in(scheme.get("id")).value(schemeIds);
|
| 846 |
if (!isAdmin) {
|
852 |
if (!isAdmin) {
|
| 847 |
|
853 |
|
| 848 |
finalPredicate = cb.and(p1, p2, p3);
|
854 |
finalPredicate = cb.and(p1, p2, p3);
|
| 849 |
query.where(finalPredicate);
|
855 |
query.where(finalPredicate);
|