diff --git a/contact-center/app/src/main/java/com/cskefu/cc/proxy/LicenseProxy.java b/contact-center/app/src/main/java/com/cskefu/cc/proxy/LicenseProxy.java index 1b2a54fd..ba8bc358 100644 --- a/contact-center/app/src/main/java/com/cskefu/cc/proxy/LicenseProxy.java +++ b/contact-center/app/src/main/java/com/cskefu/cc/proxy/LicenseProxy.java @@ -260,6 +260,27 @@ public class LicenseProxy { for (int i = 0; i < data.length(); i++) { JSONObject lic = (JSONObject) data.get(i); + if(StringUtils.equals(lic.getJSONObject(Constants.LICENSE).getString(Constants.STATUS), "notfound")){ + // fill in placeholders for notfound license + final JSONObject licenseJsonTmp = lic.getJSONObject(Constants.LICENSE); + licenseJsonTmp.put("effectivedateend", "N/A"); + licenseJsonTmp.put("quotaeffectiveremaining", "N/A"); + + JSONObject productJsonTmp = new JSONObject(); + productJsonTmp.put("shortId", "N/A"); + productJsonTmp.put("name", "N/A"); + lic.put("product", productJsonTmp); + + JSONObject userJsonTmp = new JSONObject(); + userJsonTmp.put("nickname", "N/A"); + lic.put("user", userJsonTmp); + +// lic.put(Constants.ADDDATE, null); + + result.add(lic); + continue; + } + try { Date addDate = DateConverter.parseCSTAsChinaTimezone(addDates.get(lic.getJSONObject(Constants.LICENSE).getString(Constants.SHORTID))); lic.put(Constants.ADDDATE, addDate); diff --git a/contact-center/app/src/main/java/com/cskefu/cc/util/PugHelper.java b/contact-center/app/src/main/java/com/cskefu/cc/util/PugHelper.java index 7dd04410..93934acd 100644 --- a/contact-center/app/src/main/java/com/cskefu/cc/util/PugHelper.java +++ b/contact-center/app/src/main/java/com/cskefu/cc/util/PugHelper.java @@ -20,13 +20,26 @@ import java.text.SimpleDateFormat; import java.util.*; public class PugHelper { - public String formatDate(String pattern, Date value) { - if (value == null) { - return ""; - } + public final static String NA = "N/A"; - SimpleDateFormat format = new SimpleDateFormat(pattern); - return format.format(value); + + public String formatDate(String pattern, Date value) { + try { + if (value == null) { + return NA; + } + + SimpleDateFormat format = new SimpleDateFormat(pattern); + String result = format.format(value); + + if (StringUtils.isBlank(result)) { + return NA; + } + return result; + } catch (Exception e) { + e.printStackTrace(); + } + return NA; } public String padRight(Object src, String ch) { @@ -140,6 +153,7 @@ public class PugHelper { /** * 截取字符串,首先根据分隔符分隔,然后选取前 N 个,使用连接符连接返回 + * * @param orignal * @param splitBy * @param firstN diff --git a/contact-center/app/src/main/resources/templates/admin/license/index.pug b/contact-center/app/src/main/resources/templates/admin/license/index.pug index 2093c03c..d76f6f90 100644 --- a/contact-center/app/src/main/resources/templates/admin/license/index.pug +++ b/contact-center/app/src/main/resources/templates/admin/license/index.pug @@ -25,7 +25,7 @@ block content .row(style='padding:5px;') blockquote.layui-elem-quote.layui-quote-nm i.layui-icon(style="color:gray")  - font(color="#999").layui-word-aux balala ... + font(color="#999").layui-word-aux 春松客服使用授权证书是通过 Chatopera 证书商店(https://store.chatopera.com)分发的对【春松客服计费资源】进行管理的凭证,在使用春松客服的过程中,春松客服与 Chatopera 证书商店集成,完成证书购买、证书绑定、配额扣除、配额同步和开具发票等。 .col-lg-12 table.layui-table(lay-skin='line') @@ -83,11 +83,6 @@ block content else if (msg == 'notfound_id') top.layer.alert('不存在该证书信息', {icon: 2}); - layui.use(['laypage', 'layer'], function () { - var laypage = layui.laypage - , layer = layui.layer; - }); - function copyLicenseId2ClipboardOnOS(val){ copyValue2ClipboardOnOS(val, (err) => { top.layer.msg('复制完成', {icon: 1, time: 2000, offset: 't'}); @@ -95,6 +90,11 @@ block content } function openLicenseStorePage() { - var licenseStoreProvider = "#{licenseStoreProvider}"; + var licenseStoreProvider = "#{licenseStoreProvider}/product/cskefu001"; window.open(licenseStoreProvider, "_blank"); - } \ No newline at end of file + } + + layui.use(['laypage', 'layer'], function () { + var laypage = layui.laypage + , layer = layui.layer; + }); \ No newline at end of file