|
@@ -4,6 +4,7 @@ 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.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
@@ -43,14 +44,21 @@ import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
+import com.zhongzheng.modules.grade.service.impl.ClassGradeServiceImpl;
|
|
|
+import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
+import com.zhongzheng.modules.system.domain.SysOldOrg;
|
|
|
import com.zhongzheng.modules.user.bo.UserCertificateAddBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
|
|
|
+import com.zhongzheng.modules.user.domain.UserCertificate;
|
|
|
import com.zhongzheng.modules.user.service.IUserCertificateService;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
|
|
|
import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -76,6 +84,8 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, CertificateTp> implements ICertificateTpService {
|
|
|
|
|
|
+ private static Logger log = LoggerFactory.getLogger(CertificateTpServiceImpl.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private IGoodsService iGoodsService;
|
|
|
@Autowired
|
|
@@ -103,6 +113,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseModuleService iCourseModuleService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOrderGoodsService iOrderGoodsService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IMajorService iMajorService;
|
|
|
@Value("${certificate.host}")
|
|
@@ -179,6 +193,14 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getGoodsId())){
|
|
|
throw new CustomException("数据错误");
|
|
|
}
|
|
|
+ UserCertificate userCertificate = iUserCertificateService.getOne(new LambdaQueryWrapper<UserCertificate>()
|
|
|
+ .eq(UserCertificate::getUserId, bo.getUserId())
|
|
|
+ .eq(UserCertificate::getGradeId,bo.getGradeId()).last("limit 1"));
|
|
|
+ if(Validator.isNotEmpty(userCertificate)){
|
|
|
+ System.out.println("已存在证书");
|
|
|
+ log.info("已存在证书" + bo.getUserId()+"-"+bo.getGradeId(), "");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
bo.setPageSize(null);
|
|
|
bo.setPageNum(null);
|
|
|
GoodsVo goodsVo = iGoodsService.selectDetail(bo.getGoodsId());
|
|
@@ -260,9 +282,26 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public String makeBatchCertificatePhoto(ClassGradeUserQueryBo bo) {
|
|
|
+ List<ClassGradeUser> list = iClassGradeUserService.list(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getPeriodStatus, 1).ge(ClassGradeUser::getCreateTime,bo.getClassStartTime()));
|
|
|
+ for(ClassGradeUser gradeUser : list){
|
|
|
+ ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
|
|
|
+ queryBo.setGradeId(gradeUser.getGradeId());
|
|
|
+ queryBo.setUserId(gradeUser.getUserId());
|
|
|
+ queryBo.setOrderGoodsId(gradeUser.getOrderGoodsId());
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>()
|
|
|
+ .eq(OrderGoods::getOrderGoodsId, gradeUser.getOrderGoodsId()));
|
|
|
+ queryBo.setGoodsId(orderGoods.getGoodsId());
|
|
|
+ System.out.println("生成证书");
|
|
|
+ System.out.println(JSON.toJSONString(queryBo));
|
|
|
+ makeCertificatePhoto(queryBo);
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -614,6 +653,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
addBo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
|
|
|
addBo.setModuleId(moduleId);
|
|
|
addBo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
+ addBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
return addBo;
|
|
|
}
|
|
|
private String getCertificateCode(){
|