Commit 1393b8ac authored by 刘林's avatar 刘林

fix(jg):【生产问题】【维保合同备案打开无内容】使用单位打开维保合同备案单据详情,页面无内容展示

parent 41ba7c8e
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -174,26 +175,23 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
} else {
// 完成的显示历史表的数据
JSONArray objects = commonService.queryHistoryDataObj(dto.getSequenceNbr());
// 兼容老数据
if (objects.isEmpty()) {
List<Map<String, Object>> list = maintenanceContractMapper.selectEquipList(sequenceNbr);
if (!ObjectUtils.isEmpty(list)) {
vo.setEquipmentLists(list);
}
List<Map<String, Object>> equipmentList;
if (objects == null || objects.isEmpty()) {
equipmentList = Optional.ofNullable(maintenanceContractMapper.selectEquipList(sequenceNbr))
.orElse(Collections.emptyList());
} else {
//如果EQU_DEFINE是数字进行转换
for (int i = 0; i < objects.size(); i++) {
JSONObject currentObject = objects.getJSONObject(i);
String equDefineCode = currentObject.getString("EQU_DEFINE");
if (equDefineCode.chars().anyMatch(Character::isDigit)) {
currentObject.put("EQU_DEFINE", maintenanceContractMapper.getNameByEquDefine(equDefineCode));
// 遍历 JSONArray,如果 EQU_DEFINE 包含数字,则进行转换
objects.forEach(obj -> {
JSONObject json = (JSONObject) obj;
String equDefineCode = json.getString("EQU_DEFINE");
if (equDefineCode != null && equDefineCode.chars().anyMatch(Character::isDigit)) {
String name = maintenanceContractMapper.getNameByEquDefine(equDefineCode);
json.put("EQU_DEFINE", name);
}
}
List equList = objects.toJavaList(Map.class);
vo.setEquipmentLists(equList);
});
equipmentList = JSONObject.parseObject(objects.toJSONString(),new TypeReference<List<Map<String, Object>>>() {});
}
vo.setEquipmentLists(equipmentList);
}
// 对象转换 填充登录人单位类型 权限
JSONObject re = BeanUtil.copyProperties(vo, JSONObject.class);
......
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