記錄二

@RequestMapping("/queryEID")
    public @ResponseBody
    Map<String, Object> queryEID(String searchKey, String searchValue, Page page) {
        Map<String, Object> dataMap = new HashMap<String, Object>();
        // 聲明會員銀行卡對象列表
        List<AccountCardVO> accountCardVOs = new ArrayList<AccountCardVO>(); //改

        try {
                // 獲取兩個個條件屬性
                Map<String, String> params = new HashMap<String, String>();
                if(StringUtil.isNotBlank(searchKey) && "customerId".equals(searchKey)) {
                    params.put("custId", searchValue);
                    //params.put("cardType", "003");
                    logger.info(".queryAccountCard()中ReqParams的值爲:request:{}",new Gson().toJson(params));
                    CustAccountCardRes custAccountCardResult = prepaidCardInfoHPClient.queryCustPrepaidCard(params);
                    logger.info(".queryAccountCard()中ResResult的值爲:respone:{}",new Gson().toJson(custAccountCardResult));
                    if(custAccountCardResult!=null 
                            && StringUtils.equals("OK",(String) custAccountCardResult.get_sysRet()) 
                            && StringUtils.equals(SUC_CODE_000000,(String) custAccountCardResult.get_retCode())){
                        List<CustAccountCardVO> convertCardList = (List<CustAccountCardVO>) custAccountCardResult.getCardList();
                        for(CustAccountCardVO custAccountCard : convertCardList){
                            if(StringUtil.isNotBlank(custAccountCard.getIndexCardId())) {
                                logger.info("queryAccountCard IndexCardId:{}", custAccountCard.getIndexCardId());
                                Map<String, String> queryAccountParam = new HashMap<String, String>();
                                queryAccountParam.put("cardSeqId", custAccountCard.getIndexCardId());
                                Map<String, Object> accountCardResult = accountCardInfoManageHPClient.accCardInfoQuery(queryAccountParam);
                                if(accountCardResult != null 
                                        && StringUtils.equals("OK",(String) accountCardResult.get("_sysRet")) 
                                        && StringUtils.equals(SUC_CODE_000000,(String) accountCardResult.get("_retCode"))) {
                                    AccountCardVO accountCardVO = new AccountCardVO();
                                    accountCardVO.setCustomerId(custAccountCard.getCustomerId());
                                    accountCardVO.setCustomerName(customerQueryClient.queryCustInfoByCustomerId(custAccountCard.getCustomerId(),"Y").getRealName());
                                    accountCardVO.setCardIndex(custAccountCard.getIndexCardId());
                                    accountCardVO.setCardStatus(AccountCardStatusEnum.getByCode(accountCardResult.get("cardStatus").toString()).getName());
                                    accountCardVO.setBindStatus(AccountCardBindStatusEnum.getByCode(accountCardResult.get("bindStatus").toString()).getName());
                                    accountCardVO.setBindReqDatetime(accountCardResult.get("bindReqDatetime").toString());
                                    accountCardVO.setUnbindReqDatetime(accountCardResult.get("unbindReqDatetime").toString());
                                    accountCardVO.setActiveReqDatetime(accountCardResult.get("activeDatetime").toString());
                                    accountCardVO.setUnactiveReqDatetime(accountCardResult.get("unactiveDatetime").toString());
                                    accountCardVOs.add(accountCardVO);
                                }
                            }

                        }
                    }
                }else if(StringUtil.isNotBlank(searchKey) && "entityId".equals(searchKey)) {
                    Map<String, String> queryAccountParam = new HashMap<String, String>();
                    queryAccountParam.put("entityId", searchValue);
                    Map<String, Object> accountCardResult = accountCardInfoManageHPClient.accCardInfoQuery(queryAccountParam);
                    if(accountCardResult != null 
                            && StringUtils.equals("OK",(String) accountCardResult.get("_sysRet")) 
                            && StringUtils.equals(SUC_CODE_000000,(String) accountCardResult.get("_retCode"))) {
                        AccountCardVO accountCardVO = new AccountCardVO();
                        accountCardVO.setCustomerId(accountCardResult.get("customerId").toString());
                        accountCardVO.setCustomerName(customerQueryClient.queryCustInfoByCustomerId(accountCardResult.get("customerId").toString(),"Y").getRealName());
                        accountCardVO.setCardIndex(accountCardResult.get("cardIndex").toString());
                        accountCardVO.setCardStatus(AccountCardStatusEnum.getByCode(accountCardResult.get("cardStatus").toString()).getName());
                        accountCardVO.setBindStatus(AccountCardBindStatusEnum.getByCode(accountCardResult.get("bindStatus").toString()).getName());
                        accountCardVO.setBindReqDatetime(accountCardResult.get("bindReqDatetime").toString());
                        accountCardVO.setUnbindReqDatetime(accountCardResult.get("unbindReqDatetime").toString());
                        accountCardVO.setActiveReqDatetime(accountCardResult.get("activeDatetime").toString());
                        accountCardVO.setUnactiveReqDatetime(accountCardResult.get("unactiveDatetime").toString());
                        accountCardVOs.add(accountCardVO);
                    }
                   
                }

        } catch (Exception e) {
            logger.error("查詢帳戶卡信息失敗,e============" + e);
        }
        dataMap.put("list", accountCardVOs);
        dataMap.put("maxCount", total);
        return dataMap;
    }

++++++++++++++html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>大敏又要熬夜了</title>
    <script>
        $(document).ready(function () {
            var cols = [
                {
                    title: '用戶名',
                    align: 'center',
                    name: 'USER_NAME',
                    width: 100,
                    sortable: false
                }, {

                }
            ];

            $('#btnEIDQuery').click(function () {

                if (!$('#queryCondition').val()) {
                    alert("查詢條件不能爲空!");
                    return;
                }
            });

            var cfg = $('#cfg').mmGrid({
                cols: cols,  //cols [],Array 數據模型  表頭/數據列
                height: 300,
                root: 'list',  //root  '', string    指定json對象的數組字段爲數據
                autoLoad: true,  //true, false    是否表格準備好時加載數據
                loadErrorText: 'error', //'數據加載出現異常', string    數據加載異常的提示文字

                params: function () {
                    if ($('#queryCondition').val() == 'customerId') {
                        return {
                            customerId: $('#conditionValue').val(),
                            status: $('#status').val()
                        };
                    } else {
                        return {
                            entityId: $('#conditionValue').val(),
                            status: $('#status').val()
                        };
                    }
                },
                //object, function(){ return {}; }
                //AJAX請求的參數。能夠是普通對象或函數。 函數返回一個參數對象,每次調用AJAX時調用。若是返回爲空則不會調用AJAX。

                nowrap: true,  //false, true    表格顯示的數據超出列寬時是否換行
                checkCol: true,   //false, true    表格顯示checkbox
                multiSelect: true,  //false, true    數據使用本地對象數組
                fullWidthRows: true, //false, true    true:表格第一次加載數據時列伸展,自動充滿表格
                url: '',  //false, string    AJAX請求數據的地址
                method: 'post',  //'post', 'get'    AJAX提交方式
                //plugins:[]

            })

        }
    </script>
</head>
<body>
    <div class="query">
        <div class="input-prepend">
            <span class="add-on">查詢條件</span>
            <select id="queryCondition" name="queryCondition" style="width: 200px;">
                <option value="customerId">customerId</option>
                <option value="entityId">entityId</option>
            </select>
            <!-- value="${conditionValue!}" -->
            <input style="width: 200px" type="text" id="conditionValue" name="conditionValue" placeholder="請輸入……">
            <button type="button" id="btnEIDQuery" name="btnEIDQuery">查詢</button>
        </div>
        <div class="mailbox-messages">
            <table id="cfg" class="cfg">/
                <tr>
                    <th rowspan="" colspan=""></th>
                </tr>
            </table>
            <!-- <div id="pg" style="text-align: right;"></div> -->
        </div>
    </div>

</body>

</html>
相關文章
相關標籤/搜索