| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | private static JSONObject json = new JSONObject(); |
| | | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | private static QywxUtil qyUtil; |
| | | |
| | | @Value("${qiwei.serviceurl}") |
| | | private String qiweiUrl; |
| | | |
| | | @PostConstruct |
| | | private void init() { |
| | | qyUtil = this; |
| | | systemDictDataBiz = qyUtil.systemDictDataBiz; |
| | | // QywxUtil.qiweiUrl = serviceurl; |
| | | } |
| | | |
| | | |
| | |
| | | return null; |
| | | } |
| | | public static QywxSendMsgResponse sendMsg(String token, QywxSendMsgRequest param) { |
| | | String[] interfaceUrl = QywxConstant.SEND_MSG; |
| | | String url = interfaceUrl[0].replace("${accesstoken}",token); |
| | | QywxSendMsgResponse response = sendHttpRequestSingle(url,interfaceUrl[1],JSONObject.toJSONString(param) |
| | | ,new TypeReference<QywxSendMsgResponse>(){}); |
| | | if(response.getErrcode()!=null && response.getErrcode() ==0){ |
| | | return response; |
| | | try{ |
| | | String[] interfaceUrl = QywxConstant.SEND_MSG; |
| | | String url = interfaceUrl[0].replace("${accesstoken}",token); |
| | | QywxSendMsgResponse response = sendHttpRequestSingle(url,interfaceUrl[1],JSONObject.toJSONString(param) |
| | | ,new TypeReference<QywxSendMsgResponse>(){}); |
| | | log.error("推送消息结果{}",JSONObject.toJSONString(response)); |
| | | if(response.getErrcode()!=null && response.getErrcode() ==0){ |
| | | return response; |
| | | } |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | public static List<QywxUserListResponse> getUserList(String token,String depatId) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static String getJsApiTicket(String token) { |
| | | String[] interfaceUrl = QywxConstant.GET_JSAPI_TICKET; |
| | | String url = interfaceUrl[0].replace("${accesstoken}",token); |
| | | QywxBaseResponse<String> response = sendHttpRequest(url,interfaceUrl[1],"" |
| | | ,new TypeReference<QywxBaseResponse<String>>(){}); |
| | | if(response.getErrcode()!=null && response.getErrcode() ==0){ |
| | | return response.getTicket(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发起wms接口请求 |
| | | * @param url |
| | |
| | | String res = null; |
| | | try { |
| | | Map<String,String> headers = new HashMap<>(); |
| | | res = HttpsUtil.postJson(url,param); |
| | | res = HttpsUtil.postJson(qyUtil.qiweiUrl+url,param); |
| | | QywxBaseResponse result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,name); |
| | | return result; |
| | |
| | | String res = null; |
| | | try { |
| | | Map<String,String> headers = new HashMap<>(); |
| | | res = HttpsUtil.postJson(url,param); |
| | | res = HttpsUtil.postJson(qyUtil.qiweiUrl+url,param); |
| | | T result = JSONObject.parseObject(res, typeReference.getType()); |
| | | // logResult(result,name); |
| | | return result; |