|
|
@@ -2,6 +2,7 @@ package com.uas.sso.service.impl;
|
|
|
|
|
|
import com.uas.sso.AccountConfig;
|
|
|
import com.uas.sso.support.SystemSession;
|
|
|
+import com.uas.sso.util.StringUtil;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import com.uas.sso.core.Status;
|
|
|
import com.uas.sso.dao.ApplyUserSpaceDao;
|
|
|
@@ -18,6 +19,7 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.persistence.criteria.*;
|
|
|
import java.sql.Timestamp;
|
|
|
@@ -88,6 +90,7 @@ public class ApplyUserSpaceServiceImpl implements ApplyUserSpaceService {
|
|
|
CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
List<Predicate> list = new ArrayList<>();
|
|
|
list.add(cb.equal(root.get("spaceUU").as(Long.class), spaceUU));
|
|
|
+
|
|
|
Predicate[] predicates = new Predicate[list.size()];
|
|
|
predicates = list.toArray(predicates);
|
|
|
return cb.and(predicates);
|
|
|
@@ -185,4 +188,53 @@ public class ApplyUserSpaceServiceImpl implements ApplyUserSpaceService {
|
|
|
}, pageable);
|
|
|
return new PageInfo<>(pApply.getContent(), pageable, pApply.getTotalElements());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void auditApply(Long userUU, Long id, Integer status) {
|
|
|
+ // 找到申请信息
|
|
|
+ ApplyUserSpace applyUserSpace = applyUserSpaceDao.findOne(id);
|
|
|
+ if (!userUU.equals(applyUserSpace.getUserUU())) {
|
|
|
+ // 简单的校验下参数
|
|
|
+ throw new VisibleError("参数错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 修改状态
|
|
|
+ applyUserSpace.setStatus(status);
|
|
|
+ applyUserSpace.setProcessTime(new Timestamp(System.currentTimeMillis()));
|
|
|
+ applyUserSpace = applyUserSpaceDao.save(applyUserSpace);
|
|
|
+
|
|
|
+ if (status == Status.AGREE.getCode()) {
|
|
|
+ // 将用户添加到企业
|
|
|
+ userService.bindUserspace(AccountConfig.ACCOUNT_CENTER, userUU, applyUserSpace.getSpaceUU());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<ApplyUserSpace> findApplyAllToMall(Integer pageNumber, Integer pageSize, Long spaceUU, Integer status, String keyword) {
|
|
|
+ Pageable pageable = PageInfo.pageRequest(new PageRequest(pageNumber, pageSize));
|
|
|
+ Page<ApplyUserSpace> page = applyUserSpaceDao.findAll(new Specification<ApplyUserSpace>() {
|
|
|
+ @Override
|
|
|
+ public Predicate toPredicate(Root<ApplyUserSpace> root,
|
|
|
+ CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
+ List<Predicate> list = new ArrayList<>();
|
|
|
+ list.add(cb.equal(root.get("spaceUU").as(Long.class), spaceUU));
|
|
|
+ if (StringUtils.isEmpty(status)) {
|
|
|
+ list.add(cb.equal(root.get("status").as(Integer.class), Status.UNAUDIT.getCode()));
|
|
|
+ } else {
|
|
|
+ list.add(cb.equal(root.get("status").as(Integer.class), status));
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(keyword)) {
|
|
|
+ Predicate predicate1 = cb.like(root.join("user", JoinType.INNER).get("vipName").as(String.class), "%" + keyword + "%");
|
|
|
+ Predicate predicate2 = cb.like(root.join("user", JoinType.INNER).get("userUU").as(String.class), "%" + keyword + "%");
|
|
|
+ Predicate predicate3 = cb.like(root.join("user", JoinType.INNER).get("mobile").as(String.class), "%" + keyword + "%");
|
|
|
+ list.add(cb.or(predicate1, predicate2, predicate3));
|
|
|
+ }
|
|
|
+ Predicate[] predicates = new Predicate[list.size()];
|
|
|
+ predicates = list.toArray(predicates);
|
|
|
+ query.where(cb.and(predicates));
|
|
|
+ return query.getRestriction();
|
|
|
+ }
|
|
|
+ }, pageable);
|
|
|
+ return new PageInfo<>(page.getContent(), pageable, page.getTotalElements());
|
|
|
+ }
|
|
|
}
|