|
@@ -202,28 +202,54 @@ public class WbsTreeContractController extends BladeController {
|
|
|
@ApiImplicitParam(name = "tableOwner", value = "所属方节点权限,施工=1,监理=2,区分节点的数量、颜色")
|
|
|
})
|
|
|
public R<List<WbsTreeContractLazyVO>> lazyQueryContractWbsTree(@RequestParam String primaryKeyId, @RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation, @RequestParam String classifyType, @RequestParam String tableOwner) {
|
|
|
+ //这里是对应的监理合同段下,加载树时primaryKeyId=parentId;与前端对接时没沟通好入参,就不单独处理了,直接重新映射赋值一下
|
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
|
parentId = primaryKeyId;
|
|
|
}
|
|
|
+
|
|
|
+ //结果集
|
|
|
List<WbsTreeContractLazyVO> vos;
|
|
|
- String dataInfoId;
|
|
|
+
|
|
|
+ //构造Redis缓存Key
|
|
|
+ String dataInfoId = "";
|
|
|
if (("1").equals(classifyType)) {
|
|
|
dataInfoId = contractId + "_" + parentId + "_" + classifyType + "_" + tableOwner;
|
|
|
- } else {
|
|
|
- /*// TODO 监理合同段先不加缓存,存在问题
|
|
|
- dataInfoId = contractIdRelation + "_" + parentId + "_" + classifyType + "_" + tableOwner;*/
|
|
|
+ } else if (("2").equals(classifyType)) {
|
|
|
+ //监理合同段下,classifyType=1,直接查询对应的施工树缓存
|
|
|
+ dataInfoId = contractIdRelation + "_" + parentId + "_" + "1" + "_" + tableOwner;
|
|
|
+ }
|
|
|
|
|
|
- //定义一个错误id,暂时不加载缓存
|
|
|
- dataInfoId = "illegalID";
|
|
|
+ //获取Redis缓存信息
|
|
|
+ Object data = null;
|
|
|
+ if (ObjectUtil.isNotEmpty(dataInfoId)) {
|
|
|
+ if (("2").equals(classifyType) && ObjectUtil.isNotEmpty(contractIdRelation)) {
|
|
|
+ //监理根据contractIdRelation关联合同段id来判断获取缓存
|
|
|
+ data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + dataInfoId);
|
|
|
+ } else if (("1").equals(classifyType)) {
|
|
|
+ //施工直接获取缓存
|
|
|
+ data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + dataInfoId);
|
|
|
+ }
|
|
|
}
|
|
|
- Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + dataInfoId);
|
|
|
+
|
|
|
if (data != null) {
|
|
|
+ //返回缓存
|
|
|
vos = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
|
|
|
+
|
|
|
} else {
|
|
|
+ //响应结果集
|
|
|
vos = iWbsTreeContractService.lazyQueryContractWbsTree(parentId, contractId, contractIdRelation, tableOwner);
|
|
|
- if (vos != null && !dataInfoId.equals("illegalID")) { //监理不缓存
|
|
|
- JSONArray array = JSONArray.parseArray(JSON.toJSONString(vos));
|
|
|
- redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + dataInfoId, JSON.toJSON(array).toString());
|
|
|
+
|
|
|
+ //存储缓存
|
|
|
+ if (vos != null && ObjectUtil.isNotEmpty(dataInfoId)) {
|
|
|
+ //监理根据contractIdRelation关联合同段id来判断存储缓存
|
|
|
+ if (("2").equals(classifyType) && ObjectUtil.isNotEmpty(contractIdRelation)) {
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(vos));
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + dataInfoId, JSON.toJSON(array).toString());
|
|
|
+ } else if (("1").equals(classifyType)) {
|
|
|
+ //施工直接存储缓存
|
|
|
+ JSONArray array = JSONArray.parseArray(JSON.toJSONString(vos));
|
|
|
+ redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + dataInfoId, JSON.toJSON(array).toString());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return R.data(vos);
|