|
@@ -1,14 +1,20 @@
|
|
package com.ssj.service.sys.imlibuser.service.impl;
|
|
package com.ssj.service.sys.imlibuser.service.impl;
|
|
|
|
|
|
|
|
+import com.ssj.bean.common.framework.core.domain.Response;
|
|
|
|
+import com.ssj.bean.curator.TbLibBindAudit;
|
|
import com.ssj.bean.sys.imlibuser.TbClassStudent;
|
|
import com.ssj.bean.sys.imlibuser.TbClassStudent;
|
|
import com.ssj.bean.weixin.libmy.domain.LibVip;
|
|
import com.ssj.bean.weixin.libmy.domain.LibVip;
|
|
import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
|
|
import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
|
|
import com.ssj.dao.sys.imlibuser.dao.TbClassQueryDao;
|
|
import com.ssj.dao.sys.imlibuser.dao.TbClassQueryDao;
|
|
import com.ssj.dao.sys.imlibuser.dao.TbClassStudentDao;
|
|
import com.ssj.dao.sys.imlibuser.dao.TbClassStudentDao;
|
|
import com.ssj.framework.core.common.service.BaseServiceImpl;
|
|
import com.ssj.framework.core.common.service.BaseServiceImpl;
|
|
|
|
+import com.ssj.framework.core.util.StringUtil;
|
|
import com.ssj.service.conch.conch.service.ConchDerverService;
|
|
import com.ssj.service.conch.conch.service.ConchDerverService;
|
|
import com.ssj.service.sys.imlibuser.service.TbClassStudentService;
|
|
import com.ssj.service.sys.imlibuser.service.TbClassStudentService;
|
|
|
|
+import com.ssj.service.weixin.library.service.ILibJoinService;
|
|
import com.ssj.service.weixin.library.service.ILibVipService;
|
|
import com.ssj.service.weixin.library.service.ILibVipService;
|
|
|
|
+import com.ssj.service.weixin.sales.service.LibVipServiceService;
|
|
|
|
+import com.ssj.service.weixin.user.service.UserService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@@ -19,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Transactional
|
|
@Transactional
|
|
@@ -35,6 +42,15 @@ public class TbClassStudentServiceImpl extends BaseServiceImpl<TbClassStudent, S
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ILibVipService vipService;
|
|
private ILibVipService vipService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ILibJoinService joinService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private LibVipServiceService vipServiceService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -123,4 +139,81 @@ public class TbClassStudentServiceImpl extends BaseServiceImpl<TbClassStudent, S
|
|
return dao.findByVipIdAndLibId(vipId,libId);
|
|
return dao.findByVipIdAndLibId(vipId,libId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Page<Map<String, Object>> findInvalidStudentByPage(Map<String, Object> params, Pageable initPage) {
|
|
|
|
+ return queryDao.findInvalidStudentByPage(params,initPage);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Response delStudent(String libId, String vipId) {
|
|
|
|
+ //先检查数据是否可以删除
|
|
|
|
+ LibVip vip = vipService.getById(vipId);
|
|
|
|
+ Response response = new Response();
|
|
|
|
+// check(vip,response);
|
|
|
|
+// if(!response.getMeta().isSuccess()){
|
|
|
|
+// return response;
|
|
|
|
+// }
|
|
|
|
+ //查询vipId 是否有S003,'C024','C025'外的服务
|
|
|
|
+ int count = dao.findServiceNotAny(vipId,libId);
|
|
|
|
+ if(count==0){
|
|
|
|
+ //删除user表数据
|
|
|
|
+ if(StringUtils.isNotBlank(vip.getChildUserId())){
|
|
|
|
+ userService.delete(vip.getChildUserId());
|
|
|
|
+ }
|
|
|
|
+ //删除vip表数据 ?
|
|
|
|
+ vipService.delete(vipId);
|
|
|
|
+ }
|
|
|
|
+ //删除service表数据S003,'C024','C025'
|
|
|
|
+ dao.delVipServiceData(vipId,libId);
|
|
|
|
+ //删除student表数据
|
|
|
|
+ dao.delStudentData(vipId,libId);
|
|
|
|
+ return response.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Response addChildBack(String libId, String vipId) throws Exception{
|
|
|
|
+ LibVip libVip = vipService.getById(vipId);
|
|
|
|
+ Response response = new Response();
|
|
|
|
+ if (StringUtil.isBlank(libVip.getUserId())) {
|
|
|
|
+ return response.failure("此学⽣已被删除,执行失败");
|
|
|
|
+ }
|
|
|
|
+ check(libVip,response);
|
|
|
|
+ TbLibJoin libJoin =joinService.getById(libId);
|
|
|
|
+ //已经升级新服务了
|
|
|
|
+ if (libJoin.getSignType() != null && !Objects.equals(libJoin.getSignType(), 0)) {
|
|
|
|
+ int studentNum = vipService.countByLibId(libId);
|
|
|
|
+ if (studentNum > libJoin.getLibService()) {
|
|
|
|
+ return response.failure("校区⼈数达到上限,重启失败");
|
|
|
|
+ }
|
|
|
|
+ //添加校区批改服务
|
|
|
|
+ vipServiceService.insertLibServiceV1(vipId, libId);
|
|
|
|
+ }else {
|
|
|
|
+ //添加校区批改服务
|
|
|
|
+ vipServiceService.insertLibCorrectService(vipId, libId);
|
|
|
|
+ }
|
|
|
|
+ libVip.setLibId(libId);
|
|
|
|
+ vipService.save(libVip);
|
|
|
|
+ //还原原来所在班级
|
|
|
|
+ //最近所在的班级
|
|
|
|
+ String classId = dao.findRecentOwnedClassId(vipId, libId);
|
|
|
|
+ if (StringUtil.isNotBlank(classId)) {
|
|
|
|
+ //更新为有效
|
|
|
|
+ dao.updateStatusByVipIdAndLibId(vipId, libId, classId);
|
|
|
|
+ }
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Response check(LibVip libVip,Response response){
|
|
|
|
+ if (StringUtil.isNotBlank(libVip.getLibId())) {
|
|
|
|
+ return response.failure("此学⽣已绑定其他校区,执行失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = dao.findCountByVipIdAndStatus(libVip.getId(), 1);
|
|
|
|
+ if (count >0) {
|
|
|
|
+ return response.failure("此学⽣已在校区绑定审核中,执行失败");
|
|
|
|
+ }
|
|
|
|
+ response.success();
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|