|
@@ -376,6 +376,11 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
return gradePeriodStatus;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 信息推送
|
|
|
+ * @param bo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public String pushOfficialInfo(ClassGradeUserQueryBo bo){
|
|
|
ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
|
|
@@ -432,6 +437,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
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 {
|
|
@@ -449,6 +455,11 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量信息推送
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public String pushOfficialInfoMore(List<ClassGradeUserQueryBo> list) {
|
|
|
int index = 1;
|
|
@@ -463,9 +474,101 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
return errorMsg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 学时推送
|
|
|
+ * @param bo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public String pushOfficialPeriod(ClassGradeUserQueryBo bo) {
|
|
|
- return null;
|
|
|
+ ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
|
|
|
+ if(Validator.isEmpty(userVo)){
|
|
|
+ return "用户不存在";
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(userVo.getInterfacePushId())||!userVo.getInterfacePushId().equals(1L)){
|
|
|
+ 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.getClassStartTime().longValue()){
|
|
|
+ return "班级有效期已结束";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
|
|
|
+ goodsQueryBo.setUserId(bo.getUserId());
|
|
|
+ goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
|
+ OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
|
|
|
+ if(Validator.isEmpty(orderGoods)){
|
|
|
+ return "班级商品不存在";
|
|
|
+ }
|
|
|
+ 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(orderGoods.getCreateTime()));
|
|
|
+ params.put("jsrq",DateUtils.timestampToDate(userVo.getPeriodTime()));
|
|
|
+ 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 = "";
|
|
|
+ try{
|
|
|
+ respone = HttpUtils.postFormBody(OFFICIALPUSH_PERIODPATH,params);
|
|
|
+ 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());
|
|
|
+ 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());
|
|
|
+ objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodPlushTime,DateUtils.getNowTime());
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+ return respone;
|
|
|
+ }
|
|
|
+ }catch (IOException e){
|
|
|
+ throw new CustomException("请求错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量学时推送
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String pushOfficialPeriodMore(List<ClassGradeUserQueryBo> list) {
|
|
|
+ int index = 1;
|
|
|
+ String errorMsg = "";
|
|
|
+ for(ClassGradeUserQueryBo bo : list){
|
|
|
+ String msg = pushOfficialPeriod(bo);
|
|
|
+ if(Validator.isNotEmpty(msg)){
|
|
|
+ errorMsg += "第"+index+"条错误:"+ msg;
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ return errorMsg;
|
|
|
}
|
|
|
|
|
|
|