123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html;charset=UTF-8">
- <style type="text/css">
- <!--
- @import url(md.css);
- -->
- </style>
-
-
- </head>
- <body>
- <h2>通用</h2>
- <div id="page"></div>
- <h1>1 分页</h1>
- <pre><code>/** 一页的数据数量 */
- int size = 20;
- /** 超始页,一般是1 */
- int first = 1;
- /** 当前页 */
- int curr = 1;
- /** 最后页,总页数 */
- int last = 1;
- /** 总条数 */
- int total = 0;
- /** 数据超始索引 */
- int start = 0;
- /** 数据结束索引 */
- int finish = 0;
- </code></pre>
- <div id="hukou"></div>
- <h1>2 户藉常量</h1>
- <p>这里的结构是枚举类型 <code>enum(num, desc)</code></p>
- <pre><code>LOCAL_CITY(1, "本市城镇"),
- LOCAL_VILLAGE(2, "本市农村"),
- NONLOCAL_CITY(3, "外地城镇"),
- NONLOCAL_VILLAGE(4, "外地农村");
- </code></pre>
- <div id="radix"></div>
- <h1>3 基数类型</h1>
- <table><thead>
- <tr>
- <th align="left">数值</th>
- <th align="left">代表基数</th>
- </tr>
- </thead><tbody>
- <tr>
- <td align="left">1</td>
- <td align="left">自定义</td>
- </tr>
- <tr>
- <td align="left">2</td>
- <td align="left">最低工资</td>
- </tr>
- <tr>
- <td align="left">3</td>
- <td align="left">实际工资 ( 暂不支持 )</td>
- </tr>
- </tbody></table>
- <div id="ws"></div>
- <h1>4 WebSocket</h1>
- <h3>请求连接</h3>
- <p>建议使用 <a href="https://github.com/sockjs/sockjs-client" target="_blank">SockJS客户端</a>.</p>
- <h5>URI</h5>
- <pre><code>/he/ws/new/conn
- </code></pre>
- <ul>
- <li><p>前端公共JS代码</p>
- <pre><code>var webSocketSrv, ws_session_id="", curr_uri, ws_uri="/he/ws/new/conn";
- /**
- * 使用WebSocket
- * @param websocket_uri
- * @param openFunc
- * @param msgFunc
- */
- function useWebSocket(websocket_uri, openFunc, msgFunc) {
- if (webSocketSrv && webSocketSrv.readyState == 1) { // open=1, closed=3
- ws_close();
- }
- curr_uri = (undefined != websocket_uri && "" != websocket_uri) ? websocket_uri : ws_uri;
- webSocketSrv = new SockJS(curr_uri);
- if (undefined == openFunc) {
- webSocketSrv.onopen = function () {
- ws_opened(false);
- };
- } else {
- webSocketSrv.onopen = openFunc;
- }
- if (undefined == msgFunc) {
- webSocketSrv.onmessage = function (evt) {
- var data = JSON.parse(evt.data);
- if ("WS_DONE" == data.p) {
- webSocketSrv.close();
- clearInterval(ws_interval);
- }
- }
- } else {
- webSocketSrv.onmessage = msgFunc;
- }
- webSocketSrv.onerror = function (evt) {
- webSocketSrv.close();
- notice("WS因异常已关闭:"+evt.data, 8000);
- };
- }
- /**
- * 在WebSocket的 onopen, onmessage事件中调用.
- * data : JS的JSON对象.
- */
- var ws_interval, auto_conn=false, openFunc, msgFunc;
- function ws_opened(autoConn) {
- wsSessionId();
- clearInterval(ws_interval);
- notice("WS连接成功", 1);
- auto_conn = autoConn;
- if (!auto_conn) {
- return;
- }
- openFunc = webSocketSrv.onopen;
- msgFunc = webSocketSrv.onmessage;
- ws_interval = window.setInterval(function () {
- if (webSocketSrv && webSocketSrv.readyState != 1) { // open=1
- notice("WS连接已关闭, 自动尝试重连");
- if (auto_conn == false) {
- clearInterval(ws_interval);
- } else {
- useWebSocket(curr_uri, openFunc, msgFunc);
- }
- }
- }, 5000);
- }
- function ws_close() {
- webSocketSrv.close();
- clearInterval(ws_interval);
- auto_conn = false;
- }
- /**
- * 当只需要用到WS的消息展示,不发送消息时.
- * 手动获取得到WebSocket的SessionID, 发到其它接口进行消息推送
- */
- function wsSessionId() {
- if (webSocketSrv) {
- var url = webSocketSrv._transport.url;
- var uri = url.substring(url.indexOf(curr_uri)+curr_uri.length+1, url.length);
- ws_session_id = uri.substring(uri.indexOf("/")+1, uri.indexOf("/")+9);
- console.log("ws_id="+ws_session_id);
- return ws_session_id;
- }
- return "";
- }
- </code></pre></li>
- <li><p>调用</p>
- <pre><code>useWebSocket("", function () { // onopen
- ws_opened(true);
- var data = {
- p: "sync_wdsb_sbuser",
- msg: ""
- };
- webSocketSrv.send(JSON.stringify(data));
- }, function (evt) { // onmessage
- var data = JSON.parse(evt.data);
- $("#wsModal").modal({ backdrop: 'static', keyboard: false });
- $("#wsBody").prepend("<p>"+data.msg+"</p>");
- if (data.p == "WS_DONE") {
- ws_close();
- }
- }
- );
- </code></pre></li>
- </ul>
- <h3>协议</h3>
- <table><thead>
- <tr>
- <th align="left">协议号</th>
- <th align="left">描述</th>
- </tr>
- </thead><tbody>
- <tr>
- <td align="left">WS_ID</td>
- <td align="left">成功打开连接,直接推送此协议消息</td>
- </tr>
- <tr>
- <td align="left">WS_MSG</td>
- <td align="left">普通的消息</td>
- </tr>
- <tr>
- <td align="left">WS_DONE</td>
- <td align="left">成功处理,WebSocket使用结束.</td>
- </tr>
- </tbody></table>
- <h3>响应的协议消息结构</h3>
- <ul>
- <li>p 协议号</li>
- <li>msg 协议内容体</li>
- </ul>
- <pre><code class="json">{<span class="attribute">
- "p</span>": <span class="value"><span class="string">"WS_MSG"</span></span>,<span class="attribute">
- "msg</span>": <span class="value"><span class="string">"员工的五险一金方案不存在,已经终止修改。"
- }
- </span></span></code></pre>
- <hr>
- <h1 id="wxyj_status"> 5 社保数据状态 </h1>
- <blockquote>
- <p>第一个参数名: num, 第二个参数名: desc</p>
- </blockquote>
- <pre><code>PRE_PAY(1, "待付款"),
- PAY_OK(2, "完成付款"),
- APPLYING(3, "正在申报中"),
- OK(4, "参缴成功"),
- FAIL(5, "参缴不成功"),
- REFUNDED(11, "已全额退款"),
- ASK_REFUND(15, "用户申请退款"),
- WXYJ_DOC(30, "存档中(不可更改)"),
- WXYJ_GEN(31, "系统生成"),
- WXYJ_PROXY(32, "代缴生成"),
- WXYJ_CONFIRM(36, "代缴确认"),
- WXYJ_PROXYING(40, "代缴中"), // 然后接下状态:APPLYING(3, "正在申报中")、OK(4, "完成参保") 或 FAIL(5, "参保不成功"),
- WXYJ_PROXYED(44, "代缴完成")
- </code></pre>
- <hr>
- <h1 id="opt">6 操作规则</h1>
- <pre><code>enum(int num, String desc)
- INC_C_DEC_C(0, "增当月、减当月")
- INC_C_DEC_N(1, "增当月、减下月")
- INC_N_DEC_N(2, "增下月、减下月")
- </code></pre>
- <hr>
- <h1 id="hukou">7 户藉常量</h1>
- <pre><code>enum(int num, String desc)
- LOCAL_CITY(1, "本市城镇"),
- LOCAL_VILLAGE(2, "本市农村"),
- NONLOCAL_CITY(3, "外地城镇"),
- NONLOCAL_VILLAGE(4, "外地农村");
- </code></pre>
- <hr>
- <h1 id="wxyj_inc_normal_dec">8 参缴类型</h1>
- <pre><code>enum(int num, String desc)
- INC(1, "增员"),
- NORMAL(5, "在保"),
- DEC(8, "减员"),
- REPAY(11, "补缴") // 补缴数据不区分增员还是在保.
- </code></pre>
- <hr>
- <script src="md.js"></script>
- </body>
- </html>
|