1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-06-16 18:30:03 +08:00

https://github.com/cskefu/cskefu/issues/937 scan notfound and fill in data for license

Signed-off-by: Hai Liang Wang <hai@chatopera.com>
This commit is contained in:
Hai Liang Wang 2023-10-20 11:18:02 +08:00
parent 8c0448f7fc
commit dbd0a3d77c
3 changed files with 49 additions and 14 deletions

View File

@ -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);

View File

@ -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

View File

@ -25,7 +25,7 @@ block content
.row(style='padding:5px;')
blockquote.layui-elem-quote.layui-quote-nm
i.layui-icon(style="color:gray") &#xe60b;
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");
}
}
layui.use(['laypage', 'layer'], function () {
var laypage = layui.laypage
, layer = layui.layer;
});