package com.hssx.cloudmodel.constant; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hssx.cloudmodel.util.HttpKit; import com.hssx.cloudmodel.util.HttpRespMsg; import com.hssx.cloudmodel.util.WechatTemplateMessage; import org.apache.commons.lang3.StringEscapeUtils; import java.io.IOException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * Author: 吴涛涛 * Date : 2019 - 07 - 24 16:00 * Description:<描述>常量配置类 * Version: 1.0 */ public class Constant { public static final String DEFAULT_PWD = "000000";//默认密码 public static final Integer ASSETS_COMPANY = 0;//资产方编号 public static final Integer PRODUCER_COMPANY = 1;//生产方编号 public static final Integer SYS_PARENT_ID = 0;//系统管理员的上级id public static final Integer SYS_ID = 1;//系统管理员的id public static final String MOULD_PREFIX = "YMMJ";//模具编号前缀 public static final String PROJECT_PREFIX = "YMXM";//项目编号 public static final String UPLOAD = "上传";//上传 public static final String UPDATE = "申请模具更新";//申请模具更新 public static final String DOWNLOAD = "下载";//下载 public static final String APPROVAL = "审批";//审批 public static final Integer UPDATE_AUTHORITY = 0;//修改权限 public static final Integer DOWNLOAD_AUTHORITY = 1;//下载权限 public static final Integer VIEW_AUTHORITY = 2;//浏览权限 public static final Integer MAINTAIN_TYPE = 1;//保养类型 public static final Integer APPROVEL_TYPE = 0;//审批类型 public static final Integer EMERGENCY_TYPE = 2;//告警类型 public static final Integer APPROVAL_AUTHORITY = 3;//审批权限 public static final String WARNING_NOTICE_TEMPLATE_ID = "-EpBbqgMN2cCBf6pUSlFXGNlstkeCidVEejTOhrGcy4";//告警通知模板id public static final String MAINTAIN_NOTICE_TEMPLATE_ID = "VcU9E2f3Nn4uR6S1z57VBaLeBAhEO4vfivo3Tug_BKE";//保养通知模板id public static final String WECHAT_SECRET = "473ee2fab33e6d8a885800403d777581";//secret public static final String WECHAT_APPID = "wx42c0f9d19a4756a7";//appId public static final String PLAN_TYPE = "保养类型";//保养类型 public static final String MAIN_TAIN_NOTICE = "该模具需要保养,请前往处理";//保养通知 public static final String SCRAP_NOTICE = "该模具运行次数已超过寿命次数,请申请报废处理";//待报废 public static final String MAINTAIN_NAME_FIRST = "动作";//保养类型名称0 public static final String MAINTAIN_NAME_SECOND = "易损件";//保养类型名称1 public static final String MAINTAIN_WAY_FIRST = "喷漆";//对应保养类型动作 public static final String MAINTAIN_WAY_SECOND = "检查";//对应保养类型动作 public static final String PART_FILE_2D = "2D";//零件2d public static final String PART_FILE_3D = "3D";//零件3d // public static void main(String[] args){ // System.out.println("222222"); // String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" // + "wx42c0f9d19a4756a7" + "&secret=" + "473ee2fab33e6d8a885800403d777581"; // String resp; // String resp1; // try { // resp1 = HttpKit.get(url, true); // resp1 = StringEscapeUtils.unescapeJava(resp1); // System.out.println("222222"); // JSONObject json = (JSONObject) JSON.parse(resp1); // System.out.println("json"+json); // // 获取值赋值给全局变量 // if (!json.containsKey("errcode")) { // System.out.println("222222"); // String newAccessToken = json.getString("access_token"); // String url1 = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" // + newAccessToken; // WechatTemplateMessage wechat = new WechatTemplateMessage(); // wechat.setTemplate_id("VcU9E2f3Nn4uR6S1z57VBaLeBAhEO4vfivo3Tug_BKE"); // wechat.setTouser("o9g4t1rTLsDu62HrreOoMWPT4ldA"); // wechat.setAppid("wx42c0f9d19a4756a7"); // Map> data = new HashMap<>(); // Map first = new HashMap<>(); // Map value1 = new HashMap<>(); // Map value2 = new HashMap<>(); // Map value3 = new HashMap<>(); // Map value4 = new HashMap<>(); // Map remark = new HashMap<>(); // // 推送信息主体 // first.put("value", "你好,你有新的保养通知");//firstData推送标题 // data.put("first", first); // value1.put("value", "1111"); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); // data.put("keyword1", value1); // value2.put("value", "南京"); // data.put("keyword2", value2); // value3.put("value", sdf.format(new Date())); // data.put("keyword3", value3); // value4.put("value", "给水泵内燃力"); // data.put("keyword4", value4); // remark.put("value", "给水泵内燃力不足"); // data.put("remark", remark); // wechat.setData(data); // String jsonString = JSONObject.toJSONString(wechat); // System.out.println("jsonString"+jsonString); // resp = HttpKit.post(url1, jsonString); // System.out.println("222222"); // System.out.println("resp0"+resp); // resp = StringEscapeUtils.unescapeJava(resp); // System.out.println("resp"+resp); // json = (JSONObject) JSON.parse(resp); // System.out.println("json"+json); // } // } catch (NoSuchAlgorithmException e) { // e.printStackTrace(); // } catch (NoSuchProviderException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } catch (KeyManagementException e) { // e.printStackTrace(); // } // } }