|
@ -51,6 +51,7 @@ import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.utils.CheckSumBuilder;
|
|
|
import com.yihu.jw.utils.FileUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
@ -66,6 +67,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@ -928,13 +930,12 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
}
|
|
|
Long endTime = new Date().getTime();
|
|
|
Long startTime = new Date().getTime()-24*60*60*1000;
|
|
|
List vids = new ArrayList();
|
|
|
String appKey = sysDictDO.getDictValue();
|
|
|
String appSecret = hospitalSysDictDO.getDictValue();
|
|
|
String nonce = randomInt(10);
|
|
|
String curTime = String.valueOf((new Date()).getTime() / 1000L);
|
|
|
String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
|
|
|
String url = "https://vcloud.163.com/app/vod/video/get";
|
|
|
String url = "https://vcloud.163.com/app/vod/video/list";
|
|
|
Map<String,Object> httpPost = new HashedMap();
|
|
|
// 设置请求的header
|
|
|
httpPost.put("AppKey", appKey);
|
|
@ -946,6 +947,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
object.put("currentPage",500);
|
|
|
object.put("pageSize",1);
|
|
|
object.put("status",40);
|
|
|
object.put("type",0);
|
|
|
object.put("beginTime",startTime);
|
|
|
object.put("endTime",endTime);
|
|
|
logger.info("入参"+object.toJSONString());
|
|
@ -956,14 +958,13 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
if (jsonObject.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1 = jsonObject.getJSONObject("ret");
|
|
|
if (object1!=null){
|
|
|
Integer total = object1.getInteger("totalRecords");
|
|
|
JSONArray jsonArray = object1.getJSONArray("list");
|
|
|
if (jsonArray!=null&&jsonArray.size()>0){
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject object2 = jsonArray.getJSONObject(i);
|
|
|
if (object2!=null){
|
|
|
String vedioUrl =object1.getString("origUrl");
|
|
|
String vedioName = object1.getString("videoName");
|
|
|
String vedioUrl =object2.getString("origUrl");
|
|
|
String vedioName = object2.getString("videoName");
|
|
|
String filePath = "/Projects/Video/"+DateUtil.getStringDate("yyyyMMdd");
|
|
|
logger.info("filePath:"+filePath);
|
|
|
logger.info("vedioUrl"+vedioUrl);
|
|
@ -1016,6 +1017,70 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
public String saveVideoFileList(String startTime,String endTime,Integer status,Integer page ,Integer pageSize){
|
|
|
WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
|
|
|
|
|
|
WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YXAPPSECRET");
|
|
|
if (sysDictDO==null){
|
|
|
return "找不到对应的key";
|
|
|
}
|
|
|
JSONObject object = new JSONObject();
|
|
|
if (StringUtils.isNoneBlank(startTime)){
|
|
|
Long start = DateUtil.strToDate(startTime).getTime();
|
|
|
object.put("beginTime",start);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(endTime)){
|
|
|
Long end = DateUtil.strToDate(endTime).getTime();
|
|
|
object.put("endTime",end);
|
|
|
}
|
|
|
if (status!=null){
|
|
|
object.put("status",40);
|
|
|
}
|
|
|
object.put("type",0);
|
|
|
String appKey = sysDictDO.getDictValue();
|
|
|
String appSecret = hospitalSysDictDO.getDictValue();
|
|
|
String nonce = randomInt(10);
|
|
|
String curTime = String.valueOf((new Date()).getTime() / 1000L);
|
|
|
String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
|
|
|
String url = "https://vcloud.163.com/app/vod/video/list";
|
|
|
Map<String,Object> httpPost = new HashedMap();
|
|
|
// 设置请求的header
|
|
|
httpPost.put("AppKey", appKey);
|
|
|
httpPost.put("Nonce", nonce);
|
|
|
httpPost.put("CurTime", curTime);
|
|
|
httpPost.put("CheckSum", checkSum);
|
|
|
httpPost.put("Content-Type", "application/json");
|
|
|
object.put("currentPage",page);
|
|
|
object.put("pageSize",pageSize);
|
|
|
logger.info("入参"+object.toJSONString());
|
|
|
String response = httpClientUtil.postBodyHead(url,object,httpPost);
|
|
|
logger.info("返回日志"+response);
|
|
|
if(StringUtils.isNoneBlank(response)){
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
|
|
|
if (jsonObject.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1 = jsonObject.getJSONObject("ret");
|
|
|
if (object1!=null){
|
|
|
JSONArray jsonArray = object1.getJSONArray("list");
|
|
|
if (jsonArray!=null&&jsonArray.size()>0){
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject object2 = jsonArray.getJSONObject(i);
|
|
|
if (object2!=null){
|
|
|
String vedioUrl =object2.getString("origUrl");
|
|
|
String vedioName = object2.getString("videoName");
|
|
|
String filePath = "/Projects/Video/"+DateUtil.getStringDate("yyyyMMdd");
|
|
|
//String filePath = "D:\\Backup\\桌面\\配置及相关文档\\"+DateUtil.getStringDate("yyyyMMdd");
|
|
|
logger.info("filePath:"+filePath);
|
|
|
logger.info("vedioUrl"+vedioUrl);
|
|
|
FileUtil.saveUrlAs(vedioUrl,filePath,"GET",vedioName);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|