|
@@ -174,6 +174,13 @@ 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;
|
|
|
|
|
@@ -581,6 +588,7 @@ 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 "班级商品不存在";
|
|
@@ -652,6 +660,115 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String pushSevenOfficialInfo(ClassGradeUserQueryBo bo) {
|
|
|
+ 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.isNotEmpty(configService.selectConfigByKeyNoCache("office.account"))){
|
|
|
+ OFFICIALPUSH_INFOACCOUNT = configService.selectConfigByKeyNoCache("office.account");
|
|
|
+ OFFICIALPUSH_TOKEN = configService.selectConfigByKeyNoCache("office.token");
|
|
|
+ }
|
|
|
+ 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("dh", userVo.getTelPhone());
|
|
|
+ params.put("bmrq", DateUtils.timestampToDate(bmrq));
|
|
|
+ String dataTxt = params.get("zh") + params.get("bh") + params.get("xm") + params.get("sfz") + params.get("dh") + params.get("bmrq");
|
|
|
+ log.info("报名信息推送参数"+ dataTxt);
|
|
|
+ String encrypted = dataSign(dataTxt, 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;
|
|
@@ -815,6 +932,7 @@ 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 "班级商品不存在";
|
|
@@ -887,6 +1005,130 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String pushSevenOfficialPeriod(ClassGradeUserQueryBo bo) {
|
|
|
+ //企业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 "";
|
|
|
+// }
|
|
|
+
|
|
|
+ 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());
|
|
|
+ //第一条学习记录
|
|
|
+ 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(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_SEVEN_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("请求错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 批量学时推送
|
|
|
*
|