|
@@ -14,6 +14,8 @@ import com.github.pagehelper.Page;
|
|
|
import com.google.common.base.Splitter;
|
|
|
import com.zhongzheng.common.annotation.DataScope;
|
|
|
import com.zhongzheng.common.core.domain.AjaxResult;
|
|
|
+import com.zhongzheng.common.core.domain.entity.SysUser;
|
|
|
+import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
import com.zhongzheng.common.core.redis.RedisLockEntity;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
@@ -34,6 +36,7 @@ import com.zhongzheng.modules.course.vo.CourseBusinessVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseChapterVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseProjectTypeVo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsCourse;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.*;
|
|
@@ -52,6 +55,7 @@ import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
import com.zhongzheng.modules.system.domain.SysOldOrg;
|
|
|
import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
import com.zhongzheng.modules.system.service.ISysOldOrgService;
|
|
|
+import com.zhongzheng.modules.system.service.ISysUserService;
|
|
|
import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserBankRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserQueryBo;
|
|
@@ -68,6 +72,7 @@ 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.security.core.token.TokenService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -106,6 +111,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
@Autowired
|
|
|
private OssService ossService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService iSysUserService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IOrderService iOrderService;
|
|
|
|
|
@@ -121,6 +129,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
@Autowired
|
|
|
private IGoodsService iGoodsService;
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
@@ -166,12 +175,22 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
@Value("${officialPush.token}")
|
|
|
private String OFFICIALPUSH_TOKEN;
|
|
|
|
|
|
+ @Value("${officialPush.sevenInfoPath}")
|
|
|
+ private String OFFICIALPUSH_SEVEN_INFOPATH;
|
|
|
+
|
|
|
+ @Value("${officialPush.sevenPeriodPath}")
|
|
|
+ private String OFFICIALPUSH_SEVEN_PERIODPATH;
|
|
|
+
|
|
|
+
|
|
|
@Autowired
|
|
|
private IUserPeriodService iUserPeriodService;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysOldOrgService sysOldOrgService;
|
|
|
|
|
|
+ private String SEVEN_OFFICIALPUSH_INFOACCOUNT;
|
|
|
+ private String SEVEN_OFFICIALPUSH_TOKEN;
|
|
|
+
|
|
|
private static final Logger log = LoggerFactory.getLogger(ClassGradeUserServiceImpl.class);
|
|
|
|
|
|
@Override
|
|
@@ -411,6 +430,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
if (Validator.isEmpty(bo.getGradeId())) {
|
|
|
throw new CustomException("参数错误");
|
|
|
}
|
|
|
+ if (Validator.isEmpty(bo.getOrderGoodsId())) {
|
|
|
+ throw new CustomException("参数错误");
|
|
|
+ }
|
|
|
ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
|
|
|
queryBo.setGradeId(bo.getGradeId());
|
|
|
queryBo.setUserId(bo.getUserId());
|
|
@@ -422,6 +444,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
|
|
|
subjectStudyRecordQueryBo.setUserId(bo.getUserId());
|
|
|
subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
|
|
|
+ subjectStudyRecordQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
|
|
|
secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
|
|
@@ -440,6 +463,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
classGradeUserQueryBo.setGradeId(bo.getGradeId());
|
|
|
classGradeUserQueryBo.setUserId(bo.getUserId());
|
|
|
classGradeUserQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
|
|
|
+ classGradeUserQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
List<ClassPeriodUserVo> classPeriodUserVos1 = baseMapper.listPeriod(classGradeUserQueryBo);
|
|
|
ClassPeriodUserVo classPeriodUserVos = classPeriodUserVos1.get(0);
|
|
|
classPeriodUserVos.setPending(classPeriodStudentVo.getSecAllNum() - classPeriodUserVos.getPass() - classPeriodUserVos.getCheat());
|
|
@@ -533,6 +557,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
*/
|
|
|
@Override
|
|
|
public String pushOfficialInfo(ClassGradeUserQueryBo bo) {
|
|
|
+ OFFICIALPUSH_INFOACCOUNT = null;
|
|
|
+ OFFICIALPUSH_TOKEN = null;
|
|
|
log.info("报名信息推送" + JSON.toJSONString(bo));
|
|
|
//暂时先关闭信息推送入口
|
|
|
// if (true){
|
|
@@ -568,10 +594,18 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
|
|
|
goodsQueryBo.setUserId(bo.getUserId());
|
|
|
goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ goodsQueryBo.setOrderGoodsId(userVo.getOrderGoodsId());
|
|
|
OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
|
|
|
if (Validator.isEmpty(orderGoods)) {
|
|
|
return "班级商品不存在";
|
|
|
}
|
|
|
+ Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId,orderGoods.getGoodsId()));
|
|
|
+ CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
|
|
|
+ queryBo.setId(goods.getBusinessId());
|
|
|
+ String fullName = iCourseBusinessService.queryFullName(queryBo);
|
|
|
+ if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
|
|
|
+ return pushSevenOfficialInfo(bo,userVo,orderGoods);
|
|
|
+ }
|
|
|
Long bmrq = 0L;
|
|
|
if (Validator.isEmpty(userVo.getClassStartTime())) {
|
|
|
return "班级开始时间缺失";
|
|
@@ -639,6 +673,121 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public String pushSevenOfficialInfo(ClassGradeUserQueryBo bo,ClassGradeUserVo userVo,OrderGoodsVo orderGoods) {
|
|
|
+ SEVEN_OFFICIALPUSH_INFOACCOUNT=null;
|
|
|
+ SEVEN_OFFICIALPUSH_TOKEN=null;
|
|
|
+ log.info("报名信息推送" + JSON.toJSONString(bo));
|
|
|
+ //暂时先关闭信息推送入口
|
|
|
+// if (true){
|
|
|
+// return "";
|
|
|
+// }
|
|
|
+// ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
|
|
|
+ if (Validator.isEmpty(userVo)) {
|
|
|
+ return "用户不存在";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getInterfacePushId())) {
|
|
|
+ return "没开通信息推送";
|
|
|
+ } else {
|
|
|
+ ClassGradeInterface gradeInterface = iClassGradeInterfaceService.getById(userVo.getInterfacePushId());
|
|
|
+ if (gradeInterface.getType() != 1) {
|
|
|
+ return "没开通信息推送";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getOfficialName())) {
|
|
|
+ return "没配置班号";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getClassStatus()) || userVo.getClassStatus() != 1) {
|
|
|
+ return "未开班";
|
|
|
+ }
|
|
|
+ if (Validator.isNotEmpty(userVo.getClassStartTime())) {
|
|
|
+ long nowTime = System.currentTimeMillis() / 1000;
|
|
|
+ if (userVo.getClassStartTime().longValue() > nowTime) {
|
|
|
+ return "班级有效期未开始";
|
|
|
+ }
|
|
|
+ if (nowTime > userVo.getClassEndTime().longValue()) {
|
|
|
+ return "班级有效期已结束";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /* OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
|
|
|
+ goodsQueryBo.setUserId(bo.getUserId());
|
|
|
+ goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ goodsQueryBo.setOrderGoodsId(userVo.getOrderGoodsId());
|
|
|
+ OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);*/
|
|
|
+ if (Validator.isEmpty(orderGoods)) {
|
|
|
+ return "班级商品不存在";
|
|
|
+ }
|
|
|
+ Long bmrq = 0L;
|
|
|
+ if (Validator.isEmpty(userVo.getClassStartTime())) {
|
|
|
+ return "班级开始时间缺失";
|
|
|
+ }
|
|
|
+ if (userVo.getClassStartTime().longValue() < orderGoods.getCreateTime().longValue()) {
|
|
|
+ bmrq = orderGoods.getCreateTime();
|
|
|
+ } else {
|
|
|
+ bmrq = userVo.getClassStartTime();
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getRealName()) || Validator.isEmpty(userVo.getIdCard()) || Validator.isEmpty(userVo.getTelPhone())) {
|
|
|
+ return "用户信息缺失";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(orderGoods.getSevenYear())) {
|
|
|
+ return "商品年份缺失";
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("seven.office.account"))){
|
|
|
+ SEVEN_OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("seven.office.account");
|
|
|
+ SEVEN_OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("seven.office.token");
|
|
|
+ }
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("zh", SEVEN_OFFICIALPUSH_INFOACCOUNT);
|
|
|
+ params.put("bh", userVo.getOfficialName());
|
|
|
+ params.put("year", orderGoods.getSevenYear());
|
|
|
+ params.put("xm", userVo.getRealName());
|
|
|
+ params.put("sfz", userVo.getIdCard());
|
|
|
+ params.put("dh", userVo.getTelPhone());
|
|
|
+ params.put("bmrq", DateUtils.timestampToDate(bmrq));
|
|
|
+ String dataTxt = params.get("zh") + params.get("bh") + params.get("year") + params.get("xm") + params.get("sfz") + params.get("dh") + params.get("bmrq");
|
|
|
+ log.info("报名信息推送参数"+ dataTxt);
|
|
|
+ String encrypted = dataSign(dataTxt, SEVEN_OFFICIALPUSH_TOKEN);
|
|
|
+ params.put("SignMsg", encrypted);
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(OFFICIALPUSH_SEVEN_INFOPATH, params);
|
|
|
+ if (Validator.isEmpty(respone)) {
|
|
|
+ return "响应信息空";
|
|
|
+ }
|
|
|
+ String[] split = respone.split("\\|");
|
|
|
+ if (split.length < 2) {
|
|
|
+ return "推送接口返回数据错误";
|
|
|
+ }
|
|
|
+ if (split[0].equals("OK")) {
|
|
|
+ //推送成功
|
|
|
+ LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatus, 1);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusMsg, respone);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime, DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusNum, userVo.getOfficialStatusNum() + 1);
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+
|
|
|
+ //修改资料变更状态
|
|
|
+
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ //推送失败
|
|
|
+ LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusMsg, respone);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime, DateUtils.getNowTime());
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+ return respone;
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ // throw new CustomException("请求错误");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ClassPeriodStudentVo DecryptOfficialInfo(ClassGradeDecryptQueryBo bo) {
|
|
|
String pars;
|
|
@@ -680,7 +829,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
ClassGradeUser classGradeUser = null;
|
|
|
ClassGrade grade = null;
|
|
|
for (ClassGrade classGrade : classGradeList) {
|
|
|
- classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getGradeId, classGrade.getGradeId()).eq(ClassGradeUser::getUserId, user.getUserId()).last("limit 1"));
|
|
|
+ classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getGradeId, classGrade.getGradeId())
|
|
|
+ .eq(ClassGradeUser::getUserId, user.getUserId()).last("limit 1"));
|
|
|
if (Validator.isNotEmpty(classGradeUser)) {
|
|
|
grade = classGrade;
|
|
|
break;
|
|
@@ -706,12 +857,117 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
studentVo.setGoodsId(orderGoods.getGoodsId());
|
|
|
studentVo.setGoodsName(goods.getGoodsName());
|
|
|
studentVo.setFullName(fullName);
|
|
|
+ studentVo.setOrderGoodsId(orderGoods.getOrderGoodsId());
|
|
|
+ String userName = "erjian";
|
|
|
+ if(fullName.equals("继续教育二级建造师")){
|
|
|
+ studentVo.setGradeType(1);
|
|
|
+ }
|
|
|
+ if(fullName.equals("继续教育二级造价师")){
|
|
|
+ studentVo.setGradeType(2);
|
|
|
+ userName = "erzao";
|
|
|
+ }
|
|
|
+ SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>()
|
|
|
+ .eq(SysUser::getUserName, userName).last("limit 1"));
|
|
|
+ LoginUser loginUser = new LoginUser();
|
|
|
+ loginUser.setUser(sysUser);
|
|
|
+
|
|
|
+ studentVo.setToken(iUserService.createToken(loginUser));
|
|
|
+ return studentVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ClassPeriodStudentVo DecryptSevenOfficialInfo(ClassGradeDecryptQueryBo bo) {
|
|
|
+ SEVEN_OFFICIALPUSH_INFOACCOUNT=null;
|
|
|
+ SEVEN_OFFICIALPUSH_TOKEN=null;
|
|
|
+ String pars;
|
|
|
+ try {
|
|
|
+ if(Validator.isNotEmpty(bo.getTenantId())){
|
|
|
+ ServletUtils.getRequestAttributes().getResponse().setHeader("TenantId", bo.getTenantId());
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("seven.office.account"))){
|
|
|
+ SEVEN_OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("seven.office.account");
|
|
|
+ SEVEN_OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("seven.office.token");
|
|
|
+ }
|
|
|
+ byte[] Keys = new byte[]{0x22, 0x34, 0x76, 0x58, (byte) 0x90, (byte) 0xAB, (byte) 0xAD, (byte) 0xBF};
|
|
|
+ byte[] rgbKey = SEVEN_OFFICIALPUSH_TOKEN.substring(0, 8).getBytes("UTF-8");
|
|
|
+ pars = ToolsUtils.decryptDesNew(bo.getData(), SEVEN_OFFICIALPUSH_TOKEN.substring(0, 8));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CustomException("解析错误");
|
|
|
+ }
|
|
|
+ Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(pars);
|
|
|
+ String idCard = split.get("idnum");
|
|
|
+ String datetime = split.get("datetime");
|
|
|
+ String year = split.get("year");
|
|
|
+ if (Validator.isEmpty(datetime)) {
|
|
|
+ throw new CustomException("数据错误");
|
|
|
+ }
|
|
|
+ String datetimeStr = datetime.substring(0, 8);
|
|
|
+ if (!DateUtils.dateTimeNow(DateUtils.YYYYMMDD).equals(datetimeStr)) {
|
|
|
+ throw new CustomException("数据错误");
|
|
|
+ }
|
|
|
+ User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getIdCard, EncryptHandler.encrypt(idCard)).last("limit 1"));
|
|
|
+ if (Validator.isEmpty(user)) {
|
|
|
+ throw new CustomException("身份证查无用户");
|
|
|
+ }
|
|
|
+ String bh = split.get("bh");
|
|
|
+ List<ClassGrade> classGradeList = iClassGradeService.list(new LambdaQueryWrapper<ClassGrade>().eq(ClassGrade::getOfficialName, bh));
|
|
|
+ if (Validator.isEmpty(classGradeList) || classGradeList.size() == 0) {
|
|
|
+ throw new CustomException("班级不存在");
|
|
|
+ }
|
|
|
+ ClassGradeUser classGradeUser = null;
|
|
|
+ ClassGrade grade = null;
|
|
|
+ OrderGoods orderGoods = null;
|
|
|
+ for (ClassGrade classGrade : classGradeList) {
|
|
|
+ LambdaQueryWrapper<ClassGradeUser> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(ClassGradeUser::getGradeId, classGrade.getGradeId());
|
|
|
+ lqw.eq(ClassGradeUser::getUserId, user.getUserId());
|
|
|
+ List<ClassGradeUser> gradeUserList = iClassGradeUserService.list(lqw);
|
|
|
+ for (ClassGradeUser gu : gradeUserList) {
|
|
|
+ OrderGoods og = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId, gu.getOrderGoodsId())
|
|
|
+ .eq(OrderGoods::getSevenYear, year));
|
|
|
+ if (Validator.isNotEmpty(og)) {
|
|
|
+ grade = classGrade;
|
|
|
+ orderGoods = og;
|
|
|
+ classGradeUser = gu;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(classGradeUser)) {
|
|
|
+ throw new CustomException("班级用户不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Validator.isEmpty(orderGoods)) {
|
|
|
+ throw new CustomException("订单商品不存在");
|
|
|
+ }
|
|
|
+ Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, orderGoods.getGoodsId()));
|
|
|
+ CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
|
|
|
+ queryBo.setId(goods.getBusinessId());
|
|
|
+ String fullName = iCourseBusinessService.queryFullName(queryBo);
|
|
|
+ ClassPeriodStudentVo studentVo = new ClassPeriodStudentVo();
|
|
|
+ studentVo.setGradeId(grade.getGradeId());
|
|
|
+ studentVo.setClassName(grade.getClassName());
|
|
|
+ studentVo.setRealName(user.getRealname());
|
|
|
+ studentVo.setUserId(user.getUserId());
|
|
|
+ studentVo.setIdCard(idCard);
|
|
|
+ studentVo.setGoodsId(orderGoods.getGoodsId());
|
|
|
+ studentVo.setGoodsName(goods.getGoodsName());
|
|
|
+ studentVo.setFullName(fullName);
|
|
|
+ studentVo.setOrderGoodsId(orderGoods.getOrderGoodsId());
|
|
|
+ String userName = "erjian";
|
|
|
if(fullName.equals("继续教育二级建造师")){
|
|
|
studentVo.setGradeType(1);
|
|
|
}
|
|
|
if(fullName.equals("继续教育二级造价师")){
|
|
|
studentVo.setGradeType(2);
|
|
|
+ userName = "erzao";
|
|
|
}
|
|
|
+ SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>()
|
|
|
+ .eq(SysUser::getUserName, userName).last("limit 1"));
|
|
|
+ LoginUser loginUser = new LoginUser();
|
|
|
+ loginUser.setUser(sysUser);
|
|
|
+
|
|
|
+ studentVo.setToken(iUserService.createToken(loginUser));
|
|
|
return studentVo;
|
|
|
}
|
|
|
|
|
@@ -743,15 +999,14 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
*/
|
|
|
@Override
|
|
|
public String pushOfficialPeriod(ClassGradeUserQueryBo bo) {
|
|
|
+ OFFICIALPUSH_INFOACCOUNT = null;
|
|
|
+ OFFICIALPUSH_TOKEN = null;
|
|
|
//企业ID
|
|
|
String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
|
|
|
.eq(SysOldOrg::getTenantId, tenant)
|
|
|
.last("limit 1")).stream().findFirst().orElse(null);
|
|
|
- //共享班级关闭学时推送入口
|
|
|
- if (org.getShareClass() == 1) {
|
|
|
- return "";
|
|
|
- }
|
|
|
+
|
|
|
// if (true){
|
|
|
// return "";
|
|
|
// }
|
|
@@ -760,7 +1015,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
if (Validator.isEmpty(userVo)) {
|
|
|
return "用户不存在";
|
|
|
}
|
|
|
- if (Validator.isEmpty(userVo.getInterfacePushId()) || !userVo.getInterfacePushId().equals(1L)) {
|
|
|
+ if (Validator.isEmpty(userVo.getInterfacePushId())) {
|
|
|
return "没开通信息推送";
|
|
|
}
|
|
|
if (Validator.isEmpty(userVo.getOfficialName())) {
|
|
@@ -769,6 +1024,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
if (Validator.isEmpty(userVo.getClassStatus()) || userVo.getClassStatus() != 1) {
|
|
|
return "未开班";
|
|
|
}
|
|
|
+ if (Validator.isNotEmpty(userVo.getPeriodPlush())&&userVo.getPeriodPlush()==1) {
|
|
|
+ return "该用户已推送过";
|
|
|
+ }
|
|
|
if (Validator.isNotEmpty(userVo.getClassStartTime())) {
|
|
|
long nowTime = System.currentTimeMillis() / 1000;
|
|
|
if (userVo.getClassStartTime().longValue() > nowTime) {
|
|
@@ -789,11 +1047,22 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
|
|
|
goodsQueryBo.setUserId(bo.getUserId());
|
|
|
goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ goodsQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
|
|
|
if (Validator.isEmpty(orderGoods)) {
|
|
|
return "班级商品不存在";
|
|
|
}
|
|
|
-
|
|
|
+ Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId,orderGoods.getGoodsId()));
|
|
|
+ CourseBusinessQueryBo queryBo = new CourseBusinessQueryBo();
|
|
|
+ queryBo.setId(goods.getBusinessId());
|
|
|
+ String fullName = iCourseBusinessService.queryFullName(queryBo);
|
|
|
+ if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
|
|
|
+ return pushSevenOfficialPeriod(bo,userVo,orderGoods);
|
|
|
+ }
|
|
|
+ //共享班级关闭学时推送入口
|
|
|
+ if (org.getShareClass() == 1) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
/* UserProfile userProfile = iUserProfileService.getOne(new LambdaQueryWrapper<UserProfile>()
|
|
|
.eq(UserProfile::getUserId, bo.getUserId()).eq(UserProfile::getGoodsId, orderGoods.getGoodsId())
|
|
|
.eq(UserProfile::getCurrentStatus, 1).eq(UserProfile::getTypeStatus, 1)
|
|
@@ -807,19 +1076,147 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
studyRecordQueryBo.setGradeId(userVo.getGradeId());
|
|
|
//第一条学习记录
|
|
|
UserStudyRecordVo firstVo = iUserStudyRecordService.queryFirst(studyRecordQueryBo);
|
|
|
+ if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("office.account"))){
|
|
|
+ OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("office.account");
|
|
|
+ OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("office.token");
|
|
|
+ }
|
|
|
+ ClassGradeUserQueryBo userQueryBo = new ClassGradeUserQueryBo();
|
|
|
+ userQueryBo.setUserId(bo.getUserId());
|
|
|
+ userQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ Long startTime = baseMapper.getPeriodStartTime(userQueryBo);
|
|
|
+ Long endTime = baseMapper.getPeriodEndTime(userQueryBo);
|
|
|
+
|
|
|
+
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
params.put("zh", OFFICIALPUSH_INFOACCOUNT);
|
|
|
params.put("bh", userVo.getOfficialName());
|
|
|
params.put("xm", userVo.getRealName());
|
|
|
params.put("sfz", userVo.getIdCard());
|
|
|
- params.put("ksrq", DateUtils.timestampToDate(firstVo.getFirstStartTime()));
|
|
|
- params.put("jsrq", DateUtils.timestampToDate(userVo.getPeriodWaitTime()));
|
|
|
+ params.put("ksrq", DateUtils.timestampToDate(startTime));
|
|
|
+ params.put("jsrq", DateUtils.timestampToDate(endTime));
|
|
|
String dataTxt = params.get("zh") + params.get("bh") + params.get("xm") + params.get("sfz") + params.get("ksrq") + params.get("jsrq");
|
|
|
String encrypted = dataSign(dataTxt, OFFICIALPUSH_TOKEN);
|
|
|
params.put("SignMsg", encrypted);
|
|
|
String respone = "";
|
|
|
+ log.info("学时信息推送参数"+ dataTxt);
|
|
|
try {
|
|
|
respone = HttpUtils.postFormBody(OFFICIALPUSH_PERIODPATH, params);
|
|
|
+ log.info("学时信息推送参数结果"+ respone);
|
|
|
+ String[] split = respone.split("\\|");
|
|
|
+ if (split.length < 2) {
|
|
|
+ return "推送接口返回数据错误";
|
|
|
+ }
|
|
|
+ if (split[0].equals("OK")) {
|
|
|
+ //推送成功
|
|
|
+ LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlush, 1);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushMsg, respone);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushTime, DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodStatusNum, userVo.getPeriodStatusNum() + 1);
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ //推送失败
|
|
|
+ LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, userVo.getId());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushMsg, respone);
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, DateUtils.getNowTime());
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+ return respone;
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new CustomException("请求错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String pushSevenOfficialPeriod(ClassGradeUserQueryBo bo,ClassGradeUserVo userVo,OrderGoodsVo orderGoods) {
|
|
|
+ SEVEN_OFFICIALPUSH_INFOACCOUNT=null;
|
|
|
+ SEVEN_OFFICIALPUSH_TOKEN=null;
|
|
|
+ // ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
|
|
|
+ if (Validator.isEmpty(userVo)) {
|
|
|
+ return "用户不存在";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getInterfacePushId())) {
|
|
|
+ return "没开通信息推送";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getOfficialName())) {
|
|
|
+ return "没配置班号";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getClassStatus()) || userVo.getClassStatus() != 1) {
|
|
|
+ return "未开班";
|
|
|
+ }
|
|
|
+ if (Validator.isNotEmpty(userVo.getPeriodPlush())&&userVo.getPeriodPlush()==1) {
|
|
|
+ return "该用户已推送过";
|
|
|
+ }
|
|
|
+ if (Validator.isNotEmpty(userVo.getClassStartTime())) {
|
|
|
+ long nowTime = System.currentTimeMillis() / 1000;
|
|
|
+ if (userVo.getClassStartTime().longValue() > nowTime) {
|
|
|
+ return "班级有效期未开始";
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(userVo.getPeriodWaitTime())) {
|
|
|
+ return "审核状态错误";
|
|
|
+ }
|
|
|
+ //只要待审核时间早于班级结束时间就允许推送
|
|
|
+ if (userVo.getPeriodWaitTime().longValue() >= userVo.getClassEndTime().longValue()) {
|
|
|
+ return "班级有效期已结束";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (userVo.getPeriodStatus() != 1) {
|
|
|
+ return "学时审核没通过";
|
|
|
+ }
|
|
|
+
|
|
|
+ /* OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
|
|
|
+ goodsQueryBo.setUserId(bo.getUserId());
|
|
|
+ goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ goodsQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
+ OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);*/
|
|
|
+ if (Validator.isEmpty(orderGoods)) {
|
|
|
+ return "班级商品不存在";
|
|
|
+ }
|
|
|
+
|
|
|
+ /* UserProfile userProfile = iUserProfileService.getOne(new LambdaQueryWrapper<UserProfile>()
|
|
|
+ .eq(UserProfile::getUserId, bo.getUserId()).eq(UserProfile::getGoodsId, orderGoods.getGoodsId())
|
|
|
+ .eq(UserProfile::getCurrentStatus, 1).eq(UserProfile::getTypeStatus, 1)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (Validator.isNotEmpty(userProfile) && userProfile.getStatus() != 1) {
|
|
|
+ return "资料审核没通过";
|
|
|
+ }*/
|
|
|
+
|
|
|
+ UserStudyRecordQueryBo studyRecordQueryBo = new UserStudyRecordQueryBo();
|
|
|
+ studyRecordQueryBo.setUserId(bo.getUserId());
|
|
|
+ studyRecordQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ studyRecordQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
+ //第一条学习记录
|
|
|
+ UserStudyRecordVo firstVo = iUserStudyRecordService.queryFirst(studyRecordQueryBo);
|
|
|
+ if(Validator.isNotEmpty(configService.selectConfigByKeyNoCache("seven.office.account"))){
|
|
|
+ SEVEN_OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("seven.office.account");
|
|
|
+ SEVEN_OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("seven.office.token");
|
|
|
+ }
|
|
|
+ ClassGradeUserQueryBo userQueryBo = new ClassGradeUserQueryBo();
|
|
|
+ userQueryBo.setUserId(bo.getUserId());
|
|
|
+ userQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ userQueryBo.setOrderGoodsId(bo.getOrderGoodsId());
|
|
|
+ Long startTime = baseMapper.getPeriodStartTime(userQueryBo);
|
|
|
+ Long endTime = baseMapper.getPeriodEndTime(userQueryBo);
|
|
|
+
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("zh", SEVEN_OFFICIALPUSH_INFOACCOUNT);
|
|
|
+ params.put("bh", userVo.getOfficialName());
|
|
|
+ params.put("year", orderGoods.getSevenYear());
|
|
|
+ params.put("xm", userVo.getRealName());
|
|
|
+ params.put("sfz", userVo.getIdCard());
|
|
|
+ params.put("ksrq", DateUtils.timestampToDate(startTime));
|
|
|
+ params.put("jsrq", DateUtils.timestampToDate(endTime));
|
|
|
+ String dataTxt = params.get("zh") + params.get("bh") + params.get("year") + params.get("xm") + params.get("sfz") + params.get("ksrq") + params.get("jsrq");
|
|
|
+ String encrypted = dataSign(dataTxt, SEVEN_OFFICIALPUSH_TOKEN);
|
|
|
+ params.put("SignMsg", encrypted);
|
|
|
+ String respone = "";
|
|
|
+ log.info("学时信息推送参数"+ dataTxt);
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(OFFICIALPUSH_SEVEN_PERIODPATH, params);
|
|
|
+ log.info("学时信息推送参数结果"+ respone);
|
|
|
String[] split = respone.split("\\|");
|
|
|
if (split.length < 2) {
|
|
|
return "推送接口返回数据错误";
|
|
@@ -2847,6 +3244,11 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
return baseMapper.checkFinishRequiredCourse(bo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ClassGradeUser> getClassInfoByUser(Long userId) {
|
|
|
+ return baseMapper.getClassInfoByUser(userId);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 实体类转化成视图对象
|