Commit 1e7d8b78 authored by 邢磊's avatar 邢磊

*)修改二维码逻辑

parent 5cf3a0e6
......@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -262,12 +263,26 @@ public class DPSubServiceImpl {
public JSONObject buildContentData(JSONObject map, List<Object> mergedArray, JSONObject apiResult){
JSONArray datas = new JSONArray();
// 二维码
// 处理二维码
mergedArray.stream().filter(x -> "QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).findFirst().ifPresent(x -> {
JSONObject qrcode = map.getJSONObject("qrcode");
qrcode.put("text", apiResult.get("problemTime"));
String problemTime = apiResult.getString("problemTime");
String problemStatus = apiResult.getString("problemStatus");
if (!ValidationUtil.isEmpty(problemTime)){
try {
qrcode.put("text", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "yyyy-MM-dd"));
qrcode.put("subtext", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "HH:mm:ss"));
} catch (Exception e) {
e.printStackTrace();
}
}
if ("正常".equals(problemStatus)){
problemStatus = "green";
} else if("异常".equals(problemStatus)){
problemStatus = "red";
}
qrcode.put("value", !ValidationUtil.isEmpty(apiResult.get("useCode")) ? apiResult.get("useCode") : apiResult.get("USE_ORG_CODE"));
qrcode.put("status", apiResult.get("problemStatus"));
qrcode.put("status", problemStatus);
});
mergedArray = mergedArray.stream().filter(x -> !"QRCode".equals(JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.componentKey"))).collect(Collectors.toList());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment