|
@@ -111,6 +111,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
@Value("${officialPush.infoPath}")
|
|
@Value("${officialPush.infoPath}")
|
|
private String OFFICIALPUSH_INFOPATH;
|
|
private String OFFICIALPUSH_INFOPATH;
|
|
|
|
|
|
|
|
+ @Value("${officialPush.periodPath}")
|
|
|
|
+ private String OFFICIALPUSH_PERIODPATH;
|
|
|
|
+
|
|
@Value("${officialPush.infoAccount}")
|
|
@Value("${officialPush.infoAccount}")
|
|
private String OFFICIALPUSH_INFOACCOUNT;
|
|
private String OFFICIALPUSH_INFOACCOUNT;
|
|
|
|
|
|
@@ -374,35 +377,35 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Boolean pushOfficialInfo(ClassGradeUserQueryBo bo){
|
|
|
|
|
|
+ public String pushOfficialInfo(ClassGradeUserQueryBo bo){
|
|
ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
|
|
ClassGradeUserVo userVo = this.baseMapper.selectUser(bo);
|
|
if(Validator.isEmpty(userVo)){
|
|
if(Validator.isEmpty(userVo)){
|
|
- // throw new CustomException("用户不存在");
|
|
|
|
- System.out.println("用户不存在");
|
|
|
|
- return false;
|
|
|
|
|
|
+ return "用户不存在";
|
|
}
|
|
}
|
|
if(Validator.isEmpty(userVo.getInterfacePushId())||!userVo.getInterfacePushId().equals(1L)){
|
|
if(Validator.isEmpty(userVo.getInterfacePushId())||!userVo.getInterfacePushId().equals(1L)){
|
|
- // throw new CustomException("没开通信息推送");
|
|
|
|
- System.out.println("没开通信息推送");
|
|
|
|
- return false;
|
|
|
|
|
|
+ return "没开通信息推送";
|
|
}
|
|
}
|
|
if(Validator.isEmpty(userVo.getOfficialName())){
|
|
if(Validator.isEmpty(userVo.getOfficialName())){
|
|
- // throw new CustomException("没配置班号");
|
|
|
|
- System.out.println("没配置班号");
|
|
|
|
- return false;
|
|
|
|
|
|
+ return "没配置班号";
|
|
}
|
|
}
|
|
if(Validator.isEmpty(userVo.getClassStatus())||userVo.getClassStatus()!=1){
|
|
if(Validator.isEmpty(userVo.getClassStatus())||userVo.getClassStatus()!=1){
|
|
- // throw new CustomException("未开班");
|
|
|
|
- System.out.println("未开班");
|
|
|
|
- return false;
|
|
|
|
|
|
+ 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();
|
|
OrderGoodsQueryBo goodsQueryBo = new OrderGoodsQueryBo();
|
|
goodsQueryBo.setUserId(bo.getUserId());
|
|
goodsQueryBo.setUserId(bo.getUserId());
|
|
goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
goodsQueryBo.setGradeId(userVo.getGradeId());
|
|
OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
|
|
OrderGoodsVo orderGoods = iOrderGoodsService.gradeGoods(goodsQueryBo);
|
|
if(Validator.isEmpty(orderGoods)){
|
|
if(Validator.isEmpty(orderGoods)){
|
|
- // throw new CustomException("班级商品不存在");
|
|
|
|
- return false;
|
|
|
|
|
|
+ return "班级商品不存在";
|
|
}
|
|
}
|
|
Map<String, String> params = new HashMap<>();
|
|
Map<String, String> params = new HashMap<>();
|
|
params.put("zh",OFFICIALPUSH_INFOACCOUNT);
|
|
params.put("zh",OFFICIALPUSH_INFOACCOUNT);
|
|
@@ -412,7 +415,6 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
params.put("dh",userVo.getTelPhone());
|
|
params.put("dh",userVo.getTelPhone());
|
|
params.put("bmrq",DateUtils.timestampToDate(orderGoods.getCreateTime()));
|
|
params.put("bmrq",DateUtils.timestampToDate(orderGoods.getCreateTime()));
|
|
String dataTxt = params.get("zh")+params.get("bh")+params.get("xm")+params.get("sfz")+params.get("dh")+params.get("bmrq");
|
|
String dataTxt = params.get("zh")+params.get("bh")+params.get("xm")+params.get("sfz")+params.get("dh")+params.get("bmrq");
|
|
- System.out.println(dataTxt);
|
|
|
|
String encrypted = dataSign(dataTxt,OFFICIALPUSH_TOKEN);
|
|
String encrypted = dataSign(dataTxt,OFFICIALPUSH_TOKEN);
|
|
params.put("SignMsg",encrypted);
|
|
params.put("SignMsg",encrypted);
|
|
String respone = "";
|
|
String respone = "";
|
|
@@ -420,7 +422,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
respone = HttpUtils.postFormBody(OFFICIALPUSH_INFOPATH,params);
|
|
respone = HttpUtils.postFormBody(OFFICIALPUSH_INFOPATH,params);
|
|
String[] split = respone.split("\\|");
|
|
String[] split = respone.split("\\|");
|
|
if (split.length < 2) {
|
|
if (split.length < 2) {
|
|
- return false;
|
|
|
|
|
|
+ return "推送接口返回数据错误";
|
|
}
|
|
}
|
|
if(split[0].equals("OK")){
|
|
if(split[0].equals("OK")){
|
|
//推送成功
|
|
//推送成功
|
|
@@ -431,7 +433,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime,DateUtils.getNowTime());
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime,DateUtils.getNowTime());
|
|
this.update(null, objectLambdaUpdateWrapper);
|
|
this.update(null, objectLambdaUpdateWrapper);
|
|
- return true;
|
|
|
|
|
|
+ return null;
|
|
}else {
|
|
}else {
|
|
//推送失败
|
|
//推送失败
|
|
LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
@@ -440,13 +442,31 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime,DateUtils.getNowTime());
|
|
objectLambdaUpdateWrapper.set(ClassGradeUser::getOfficialStatusTime,DateUtils.getNowTime());
|
|
this.update(null, objectLambdaUpdateWrapper);
|
|
this.update(null, objectLambdaUpdateWrapper);
|
|
- throw new CustomException("推送失败:"+respone);
|
|
|
|
|
|
+ return respone;
|
|
}
|
|
}
|
|
}catch (IOException e){
|
|
}catch (IOException e){
|
|
throw new CustomException("请求错误");
|
|
throw new CustomException("请求错误");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String pushOfficialInfoMore(List<ClassGradeUserQueryBo> list) {
|
|
|
|
+ int index = 1;
|
|
|
|
+ String errorMsg = "";
|
|
|
|
+ for(ClassGradeUserQueryBo bo : list){
|
|
|
|
+ String msg = pushOfficialInfo(bo);
|
|
|
|
+ if(Validator.isNotEmpty(msg)){
|
|
|
|
+ errorMsg += "第"+index+"条错误:"+ msg;
|
|
|
|
+ }
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ return errorMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String pushOfficialPeriod(ClassGradeUserQueryBo bo) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
public static String EncoderByMd5(String str) {
|
|
public static String EncoderByMd5(String str) {
|