|
@@ -4,12 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.modules.base.service.ICertificateTpService;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
@@ -22,6 +25,7 @@ import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
|
import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
+import com.zhongzheng.modules.user.domain.User;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -157,6 +161,11 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
throw new IllegalArgumentException("您没有审核权限");
|
|
|
}
|
|
|
}
|
|
|
+ //获取旧的状态
|
|
|
+ UserPeriodStatusVo oldData = userPeriodStatusService.queryById(bo.getId());
|
|
|
+ if(oldData.getStatus()!=2){
|
|
|
+ throw new CustomException("无法修改非待审核记录");
|
|
|
+ }
|
|
|
//更改审核状态
|
|
|
UserPeriodStatus userUp = new UserPeriodStatus();
|
|
|
userUp.setPeriodStatus(1);
|
|
@@ -176,99 +185,6 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
classGradeUserQueryBo.setGradeId(userPeriodVo.getGradeId());
|
|
|
classGradeUserQueryBo.setGoodsId(userPeriodVo.getGoodsId());
|
|
|
Integer gradePeriodStatus = iClassGradeUserService.updateUserPeriodStatus(classGradeUserQueryBo);
|
|
|
- /* if(gradePeriodStatus==1){
|
|
|
- //生成证书
|
|
|
- iCertificateTpService.makeCertificatePhoto(classGradeUserQueryBo);
|
|
|
- }
|
|
|
- //通过或者不通过才发送消息
|
|
|
- if(gradePeriodStatus==1||gradePeriodStatus==0){
|
|
|
- bo.setStatus(gradePeriodStatus);
|
|
|
- sendPeriodSMS(bo);
|
|
|
- sendPeriodSevenSMS(bo);
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
- //判断是否已全部审核结束
|
|
|
- /* UserPeriodStatusVo userPeriodStatus = userPeriodStatusService.queryById(bo.getId());
|
|
|
- UserPeriodVo userPeriodVo = this.queryById(userPeriodStatus.getPeriodId());
|
|
|
- LambdaQueryWrapper<UserPeriod> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq(userPeriodVo.getUserId() != null, UserPeriod::getUserId, userPeriodVo.getUserId());
|
|
|
- lqw.eq(userPeriodVo.getGoodsId() != null, UserPeriod::getGoodsId, userPeriodVo.getGoodsId());
|
|
|
- lqw.eq(userPeriodVo.getGradeId() != null, UserPeriod::getGradeId, userPeriodVo.getGradeId());
|
|
|
- List<UserPeriod> listPeriodVo = this.list(lqw);
|
|
|
- //通过情况下判断是否已经全部审核完成,完成发送消息
|
|
|
- if (bo.getStatus().equals(1)) {
|
|
|
- for (UserPeriod userPeriod : listPeriodVo) {
|
|
|
- LambdaQueryWrapper<UserPeriodStatus> userPeriods = Wrappers.lambdaQuery();
|
|
|
- userPeriods.eq(UserPeriodStatus::getPeriodId, userPeriod.getId());
|
|
|
- userPeriods.eq(UserPeriodStatus::getPeriodStatus, 1);
|
|
|
- userPeriods.eq(UserPeriodStatus::getStatus, 1);
|
|
|
- List<UserPeriodStatus> list1 = userPeriodStatusService.list(userPeriods);
|
|
|
- //只有有一个不是通过即返回
|
|
|
- if (CollectionUtils.isEmpty(list1)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- UserPeriodEditBo userPeriodEditBo = new UserPeriodEditBo();
|
|
|
- userPeriodEditBo.setUserId(userPeriodVo.getUserId());
|
|
|
- userPeriodEditBo.setGoodsId(userPeriodVo.getGoodsId());
|
|
|
- userPeriodEditBo.setGradeId(userPeriodVo.getGradeId());
|
|
|
- userPeriodEditBo.setStatus(bo.getStatus());
|
|
|
-
|
|
|
-
|
|
|
- //修改学员班级审核状态
|
|
|
- LambdaQueryWrapper<ClassGradeUser> classGradeUser = Wrappers.lambdaQuery();
|
|
|
- classGradeUser.eq(ClassGradeUser::getUserId, userPeriodVo.getUserId());
|
|
|
- classGradeUser.eq(ClassGradeUser::getGradeId, userPeriodVo.getGradeId());
|
|
|
- ClassGradeUser classGradeUser1 = new ClassGradeUser();
|
|
|
- classGradeUser1.setPeriodStatus(1);
|
|
|
- classGradeUser1.setPeriodTime(DateUtils.getNowTime());
|
|
|
- classGradeUser1.setUpdateTime(DateUtils.getNowTime());
|
|
|
- List<ClassGradeUser> list1 = iClassGradeUserService.list(classGradeUser);
|
|
|
- iClassGradeUserService.update(classGradeUser1, classGradeUser);
|
|
|
- ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
- classGradeUserQueryBo.setUserId(userPeriodVo.getUserId());
|
|
|
- classGradeUserQueryBo.setGradeId(userPeriodVo.getGradeId());
|
|
|
- classGradeUserQueryBo.setGoodsId(userPeriodVo.getGoodsId());
|
|
|
- //处理学时通过事件
|
|
|
- periodPass(classGradeUserQueryBo);
|
|
|
- //发送消息
|
|
|
- sendPeriodSMS(userPeriodEditBo);
|
|
|
- sendPeriodSevenSMS(userPeriodEditBo);
|
|
|
-
|
|
|
- } else {
|
|
|
- //作弊情况下判断是否已经全部审核完成,完成发送消息
|
|
|
- for (UserPeriod userPeriod : listPeriodVo) {
|
|
|
- LambdaQueryWrapper<UserPeriodStatus> userPeriods = Wrappers.lambdaQuery();
|
|
|
- userPeriods.eq(UserPeriodStatus::getPeriodId, userPeriod.getId());
|
|
|
- userPeriods.eq(UserPeriodStatus::getPeriodStatus, 1);
|
|
|
- userPeriods.notIn(UserPeriodStatus::getStatus, 1);
|
|
|
- List<UserPeriodStatus> list1 = userPeriodStatusService.list(userPeriods);
|
|
|
- //只有有一个不是作弊即返回
|
|
|
- if (CollectionUtils.isEmpty(list1)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- UserPeriodEditBo userPeriodEditBo = new UserPeriodEditBo();
|
|
|
- userPeriodEditBo.setUserId(userPeriodVo.getUserId());
|
|
|
- userPeriodEditBo.setGoodsId(userPeriodVo.getGoodsId());
|
|
|
- userPeriodEditBo.setGradeId(userPeriodVo.getGradeId());
|
|
|
- userPeriodEditBo.setStatus(bo.getStatus());
|
|
|
- //发送消息
|
|
|
- sendPeriodSMS(userPeriodEditBo);
|
|
|
- sendPeriodSevenSMS(userPeriodEditBo);
|
|
|
-
|
|
|
- //更改班级学员为未通过
|
|
|
- LambdaQueryWrapper<ClassGradeUser> classGradeUser = Wrappers.lambdaQuery();
|
|
|
- classGradeUser.eq(ClassGradeUser::getUserId, userPeriodVo.getUserId());
|
|
|
- classGradeUser.eq(ClassGradeUser::getGradeId, userPeriodVo.getGradeId());
|
|
|
- ClassGradeUser classGradeUser1 = new ClassGradeUser();
|
|
|
- classGradeUser1.setPeriodStatus(0);
|
|
|
- classGradeUser1.setUpdateTime(DateUtils.getNowTime());
|
|
|
- List<ClassGradeUser> list1 = iClassGradeUserService.list(classGradeUser);
|
|
|
- iClassGradeUserService.update(classGradeUser1, classGradeUser);
|
|
|
- }
|
|
|
-*/
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -290,22 +206,29 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean editPeriodAll(UserPeriodEditBo bo) {
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ Long firstId = bo.getIds().get(0);
|
|
|
//查询此人学时审核是否有权限
|
|
|
if(!loginUser.getUser().isAdmin()){
|
|
|
- if (baseMapper.selectCountPeriod(loginUser.getUser().getUserId(),bo.getId()) < 1){
|
|
|
+ if (baseMapper.selectCountPeriod(loginUser.getUser().getUserId(),firstId) < 1){
|
|
|
throw new IllegalArgumentException("您没有审核权限");
|
|
|
}
|
|
|
}
|
|
|
//查询所有审核记录
|
|
|
- LambdaQueryWrapper<UserPeriod> lqw = Wrappers.lambdaQuery();
|
|
|
+ /* LambdaQueryWrapper<UserPeriod> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(bo.getUserId() != null, UserPeriod::getUserId, bo.getUserId());
|
|
|
lqw.eq(bo.getGoodsId() != null, UserPeriod::getGoodsId, bo.getGoodsId());
|
|
|
lqw.eq(bo.getGradeId() != null, UserPeriod::getGradeId, bo.getGradeId());
|
|
|
- List<UserPeriod> list = this.list(lqw);
|
|
|
+ List<UserPeriod> list = this.list(lqw);*/
|
|
|
//更改待审审核状态
|
|
|
- for (UserPeriod userPeriod : list) {
|
|
|
+ for (Long id : bo.getIds()) {
|
|
|
+ //获取旧的状态
|
|
|
+ UserPeriodStatusVo oldData = userPeriodStatusService.queryById(id);
|
|
|
+ if(oldData.getStatus()!=2){
|
|
|
+ throw new CustomException("无法修改非待审核记录");
|
|
|
+ }
|
|
|
UserPeriodStatus userPeriodStatus = new UserPeriodStatus();
|
|
|
userPeriodStatus.setPeriodStatus(1);
|
|
|
userPeriodStatus.setStatus(bo.getStatus());
|
|
@@ -314,7 +237,7 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
userPeriodStatus.setAuditReason(bo.getAuditReason());
|
|
|
userPeriodStatus.setAuditUserName(SecurityUtils.getUsername());
|
|
|
LambdaQueryWrapper<UserPeriodStatus> userPeriods = Wrappers.lambdaQuery();
|
|
|
- userPeriods.eq(UserPeriodStatus::getPeriodId, userPeriod.getId());
|
|
|
+ userPeriods.eq(UserPeriodStatus::getId, id);
|
|
|
userPeriods.eq(UserPeriodStatus::getPeriodStatus, 1);
|
|
|
userPeriods.eq(UserPeriodStatus::getStatus, 2);
|
|
|
userPeriodStatusService.update(userPeriodStatus, userPeriods);
|
|
@@ -338,6 +261,87 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ //学时审核确定通过
|
|
|
+ @Override
|
|
|
+ public Boolean confirmPeriod(UserPeriodEditBo bo) {
|
|
|
+ if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getGradeId())){
|
|
|
+ throw new CustomException("参数不全");
|
|
|
+ }
|
|
|
+ ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getUserId, bo.getUserId())
|
|
|
+ .eq(ClassGradeUser::getGradeId, bo.getGradeId())
|
|
|
+ .last("limit 1"));
|
|
|
+ if(Validator.isEmpty(classGradeUser)||classGradeUser.getPeriodStatus()!=3){
|
|
|
+ throw new CustomException("非审核中状态无法确认审核");
|
|
|
+ }
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ //查询此人学时审核是否有权限
|
|
|
+ if(!loginUser.getUser().isAdmin()){
|
|
|
+ if (baseMapper.selectCountConfirmPeriod(loginUser.getUser().getUserId(),bo.getId()) < 1){
|
|
|
+ throw new CustomException("您没有确认审核权限");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, classGradeUser.getId());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodStatus, 1);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ iClassGradeUserService.update(null, objectLambdaUpdateWrapper);
|
|
|
+ ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
+ classGradeUserQueryBo.setUserId(bo.getUserId());
|
|
|
+ classGradeUserQueryBo.setGradeId(bo.getGradeId());
|
|
|
+ classGradeUserQueryBo.setGoodsId(bo.getGoodsId());
|
|
|
+ periodPass(classGradeUserQueryBo);
|
|
|
+ //发送消息
|
|
|
+ bo.setStatus(1);
|
|
|
+ sendPeriodSMS(bo);
|
|
|
+ sendPeriodSevenSMS(bo);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打回操作
|
|
|
+ * @param bo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean rollbackPeriod(UserPeriodEditBo bo) {
|
|
|
+ if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getGradeId())){
|
|
|
+ throw new CustomException("参数不全");
|
|
|
+ }
|
|
|
+ ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getUserId, bo.getUserId())
|
|
|
+ .eq(ClassGradeUser::getGradeId, bo.getGradeId())
|
|
|
+ .last("limit 1"));
|
|
|
+ if(Validator.isEmpty(classGradeUser)||classGradeUser.getPeriodStatus()!=3){
|
|
|
+ throw new CustomException("非审核中状态无法打回操作");
|
|
|
+ }
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ //查询此人学时审核是否有权限
|
|
|
+ if(!loginUser.getUser().isAdmin()){
|
|
|
+ if (baseMapper.selectCountConfirmPeriod(loginUser.getUser().getUserId(),bo.getId()) < 1){
|
|
|
+ throw new CustomException("您没有确认审核权限");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //打回待审审核状态
|
|
|
+ for (Long id : bo.getIds()) {
|
|
|
+ UserPeriodStatus userPeriodStatus = new UserPeriodStatus();
|
|
|
+ userPeriodStatus.setPeriodStatus(1);
|
|
|
+ userPeriodStatus.setStatus(2);
|
|
|
+ userPeriodStatus.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ userPeriodStatus.setAuditUserName(SecurityUtils.getUsername());
|
|
|
+ LambdaQueryWrapper<UserPeriodStatus> userPeriods = Wrappers.lambdaQuery();
|
|
|
+ userPeriods.eq(UserPeriodStatus::getId, id);
|
|
|
+ userPeriods.eq(UserPeriodStatus::getPeriodStatus, 1);
|
|
|
+ userPeriodStatusService.update(userPeriodStatus, userPeriods);
|
|
|
+ }
|
|
|
+ //状态改回待审核状态
|
|
|
+ classGradeUser.setPeriodStatus(2);
|
|
|
+ classGradeUser.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iClassGradeUserService.updateById(classGradeUser);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
//学时通过处理事件
|
|
|
private void periodPass(ClassGradeUserQueryBo classGradeUserQueryBo){
|
|
|
//生成证书
|