|
@@ -80,6 +80,7 @@ public class MeterTreeController extends BladeController {
|
|
systemTree.setNodeName(obj.getName());
|
|
systemTree.setNodeName(obj.getName());
|
|
systemTree.setParentId(0L);
|
|
systemTree.setParentId(0L);
|
|
systemTree.setAncestor("0");
|
|
systemTree.setAncestor("0");
|
|
|
|
+ systemTree.setSort(1);
|
|
return R.data(meterTreeSystemService.save(systemTree));
|
|
return R.data(meterTreeSystemService.save(systemTree));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -269,15 +270,46 @@ public class MeterTreeController extends BladeController {
|
|
return R.data(null);
|
|
return R.data(null);
|
|
}
|
|
}
|
|
|
|
|
|
- @GetMapping("/project/detail")
|
|
|
|
|
|
+ @GetMapping("/project/refresh")
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperationSupport(order = 13)
|
|
|
|
+ @ApiOperation(value = "项目树初始化(新增、增量同步)", notes = "传入项目projectId")
|
|
|
|
+ public R<Object> projectRefresh(@RequestParam String projectId) {
|
|
|
|
+ if (StringUtils.isEmpty(projectId)) {
|
|
|
|
+ throw new ServiceException("未获取到项目信息");
|
|
|
|
+ }
|
|
|
|
+ ProjectInfo projectInfo = jdbcTemplate.query("SELECT * FROM m_project_info WHERE id = " + projectId, new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
|
|
|
|
+ if (projectInfo != null && ObjectUtil.isNotEmpty(projectInfo.getMeterTemplateId())) {
|
|
|
|
+
|
|
|
|
+ /*加锁*/
|
|
|
|
+ String redisKey = "meter:project:refresh-tree:" + projectId;
|
|
|
|
+ String redisValue = bladeRedis.get(redisKey);
|
|
|
|
+ if (StringUtils.isNotEmpty(redisValue) && redisValue.equals("1")) {
|
|
|
|
+ return R.fail(400, "请勿重复提交,60秒后再尝试");
|
|
|
|
+ }
|
|
|
|
+ bladeRedis.set(redisKey, "1");
|
|
|
|
+ bladeRedis.expire(redisKey, 60);
|
|
|
|
+
|
|
|
|
+ /*初始化 或 增量同步 项目计量树*/
|
|
|
|
+ boolean result = meterTreeProjectService.projectTreeInitOrSync(projectInfo.getMeterTemplateId(), Long.parseLong(projectId));
|
|
|
|
+ if (result) {
|
|
|
|
+ return R.success("操作成功");
|
|
|
|
+ } else {
|
|
|
|
+ return R.fail("操作失败");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ throw new ServiceException("未获取到项目关联的系统单元信息,操作失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/project/detail")
|
|
|
|
+ @ApiOperationSupport(order = 14)
|
|
@ApiOperation(value = "项目树节点详情", notes = "传入id")
|
|
@ApiOperation(value = "项目树节点详情", notes = "传入id")
|
|
public R<MeterTreeProject> projectDetail(@RequestParam String id) {
|
|
public R<MeterTreeProject> projectDetail(@RequestParam String id) {
|
|
return R.data(meterTreeProjectService.getById(id));
|
|
return R.data(meterTreeProjectService.getById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/project/save")
|
|
@PostMapping("/project/save")
|
|
- @ApiOperationSupport(order = 14)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 15)
|
|
@ApiOperation(value = "项目树节点新增", notes = "传入MeterTreeProject(上级的id赋值到parentId字段上提交)")
|
|
@ApiOperation(value = "项目树节点新增", notes = "传入MeterTreeProject(上级的id赋值到parentId字段上提交)")
|
|
public R<Object> projectSave(@RequestBody MeterTreeProject obj) {
|
|
public R<Object> projectSave(@RequestBody MeterTreeProject obj) {
|
|
/*计算parentId、ancestor*/
|
|
/*计算parentId、ancestor*/
|
|
@@ -302,7 +334,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/project/update")
|
|
@PostMapping("/project/update")
|
|
- @ApiOperationSupport(order = 15)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 16)
|
|
@ApiOperation(value = "项目树节点修改", notes = "传入MeterTreeProject")
|
|
@ApiOperation(value = "项目树节点修改", notes = "传入MeterTreeProject")
|
|
public R<Object> projectUpdate(@RequestBody MeterTreeProject obj) {
|
|
public R<Object> projectUpdate(@RequestBody MeterTreeProject obj) {
|
|
obj.setUpdateStatus(1); //编辑
|
|
obj.setUpdateStatus(1); //编辑
|
|
@@ -310,7 +342,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/project/remove")
|
|
@GetMapping("/project/remove")
|
|
- @ApiOperationSupport(order = 16)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 17)
|
|
@ApiOperation(value = "项目树节点删除", notes = "传入id")
|
|
@ApiOperation(value = "项目树节点删除", notes = "传入id")
|
|
public R<Object> projectRemove(@RequestParam String id) {
|
|
public R<Object> projectRemove(@RequestParam String id) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
@@ -353,7 +385,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/project/same-list")
|
|
@GetMapping("/project/same-list")
|
|
- @ApiOperationSupport(order = 17)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 18)
|
|
@ApiOperation(value = "项目树节点同级列表", notes = "传入parentId")
|
|
@ApiOperation(value = "项目树节点同级列表", notes = "传入parentId")
|
|
public R<List<MeterTreeProject>> projectSameList(@RequestParam String parentId) {
|
|
public R<List<MeterTreeProject>> projectSameList(@RequestParam String parentId) {
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
@@ -366,7 +398,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/project/sort")
|
|
@PostMapping("/project/sort")
|
|
- @ApiOperationSupport(order = 18)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 19)
|
|
@ApiOperation(value = "项目树节点同级排序", notes = "传入节点ids逗号拼接字符串,按照顺序从上到下")
|
|
@ApiOperation(value = "项目树节点同级排序", notes = "传入节点ids逗号拼接字符串,按照顺序从上到下")
|
|
public R<Object> projectSort(@RequestBody String ids) {
|
|
public R<Object> projectSort(@RequestBody String ids) {
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
@@ -384,7 +416,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/project/lazy")
|
|
@GetMapping("/project/lazy")
|
|
- @ApiOperationSupport(order = 19)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 20)
|
|
@ApiOperation(value = "项目树节点懒加载", notes = "传入projectId、节点id(根节点id=0)")
|
|
@ApiOperation(value = "项目树节点懒加载", notes = "传入projectId、节点id(根节点id=0)")
|
|
public R<List<MeterTreeProject>> projectLazy(@RequestParam String projectId, @RequestParam String id) {
|
|
public R<List<MeterTreeProject>> projectLazy(@RequestParam String projectId, @RequestParam String id) {
|
|
if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(projectId)) {
|
|
if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(projectId)) {
|
|
@@ -398,16 +430,19 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/refresh")
|
|
@GetMapping("/contract/refresh")
|
|
- @ApiOperationSupport(order = 20)
|
|
|
|
- @ApiOperation(value = "合同段树新增、同步(重加载树)", notes = "传入项目projectId、合同段contractId")
|
|
|
|
|
|
+ @ApiOperationSupport(order = 21)
|
|
|
|
+ @ApiOperation(value = "合同段树初始化(新增、增量同步)", notes = "传入项目projectId、合同段contractId")
|
|
public R<Object> contractRefresh(@RequestParam String projectId, @RequestParam String contractId) {
|
|
public R<Object> contractRefresh(@RequestParam String projectId, @RequestParam String contractId) {
|
|
boolean result = false;
|
|
boolean result = false;
|
|
if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
|
|
if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
|
|
|
|
+ /*加锁*/
|
|
String redisKey = "meter:contract:refresh-tree:" + projectId + "_" + contractId;
|
|
String redisKey = "meter:contract:refresh-tree:" + projectId + "_" + contractId;
|
|
String redisValue = bladeRedis.get(redisKey);
|
|
String redisValue = bladeRedis.get(redisKey);
|
|
if (StringUtils.isNotEmpty(redisValue) && redisValue.equals("1")) {
|
|
if (StringUtils.isNotEmpty(redisValue) && redisValue.equals("1")) {
|
|
return R.fail(400, "请勿重复提交,60秒后再尝试");
|
|
return R.fail(400, "请勿重复提交,60秒后再尝试");
|
|
}
|
|
}
|
|
|
|
+ bladeRedis.set(redisKey, "1");
|
|
|
|
+ bladeRedis.expire(redisKey, 60);
|
|
|
|
|
|
/*首先判断是否存在项目树*/
|
|
/*首先判断是否存在项目树*/
|
|
MeterTreeProject rootNode = meterTreeProjectService.getBaseMapper().selectOne(Wrappers.<MeterTreeProject>lambdaQuery()
|
|
MeterTreeProject rootNode = meterTreeProjectService.getBaseMapper().selectOne(Wrappers.<MeterTreeProject>lambdaQuery()
|
|
@@ -418,12 +453,6 @@ public class MeterTreeController extends BladeController {
|
|
.eq(MeterTreeProject::getStatus, 1));
|
|
.eq(MeterTreeProject::getStatus, 1));
|
|
|
|
|
|
if (rootNode != null) {
|
|
if (rootNode != null) {
|
|
- /*当前项目所有树*/
|
|
|
|
- List<MeterTreeProject> meterTreeProjects = meterTreeProjectService.getBaseMapper().selectList(Wrappers.<MeterTreeProject>lambdaQuery()
|
|
|
|
- .eq(MeterTreeProject::getTemplateId, rootNode.getTemplateId())
|
|
|
|
- .eq(MeterTreeProject::getProjectId, projectId)
|
|
|
|
- .eq(MeterTreeProject::getStatus, 1));
|
|
|
|
-
|
|
|
|
/*判断合同段是否存在树,不存在为初始化,存在则为同步*/
|
|
/*判断合同段是否存在树,不存在为初始化,存在则为同步*/
|
|
Long count = meterTreeContractService.getBaseMapper().selectCount(Wrappers.<MeterTreeContract>lambdaQuery()
|
|
Long count = meterTreeContractService.getBaseMapper().selectCount(Wrappers.<MeterTreeContract>lambdaQuery()
|
|
.eq(MeterTreeContract::getTemplateId, rootNode.getTemplateId())
|
|
.eq(MeterTreeContract::getTemplateId, rootNode.getTemplateId())
|
|
@@ -433,18 +462,26 @@ public class MeterTreeController extends BladeController {
|
|
.eq(MeterTreeContract::getStatus, 1));
|
|
.eq(MeterTreeContract::getStatus, 1));
|
|
|
|
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
- /*初始化新增到合同段*/
|
|
|
|
|
|
+ /*当前项目所有树*/
|
|
|
|
+ List<MeterTreeProject> meterTreeProjects = meterTreeProjectService.getBaseMapper().selectList(Wrappers.<MeterTreeProject>lambdaQuery()
|
|
|
|
+ .eq(MeterTreeProject::getTemplateId, rootNode.getTemplateId())
|
|
|
|
+ .eq(MeterTreeProject::getProjectId, projectId)
|
|
|
|
+ .eq(MeterTreeProject::getStatus, 1));
|
|
|
|
+
|
|
|
|
+ /*初始化 合同段计量树*/
|
|
result = meterTreeContractService.contractTreeInit(meterTreeProjects, Long.parseLong(contractId));
|
|
result = meterTreeContractService.contractTreeInit(meterTreeProjects, Long.parseLong(contractId));
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- /*同步修改到合同段(增量)*/
|
|
|
|
|
|
+ /*当前项目所有树*/
|
|
|
|
+ List<MeterTreeProject> meterTreeProjects = meterTreeProjectService.getBaseMapper().selectList(Wrappers.<MeterTreeProject>lambdaQuery()
|
|
|
|
+ .select(MeterTreeProject::getId, MeterTreeProject::getParentId)
|
|
|
|
+ .eq(MeterTreeProject::getTemplateId, rootNode.getTemplateId())
|
|
|
|
+ .eq(MeterTreeProject::getProjectId, projectId)
|
|
|
|
+ .eq(MeterTreeProject::getStatus, 1));
|
|
|
|
+
|
|
|
|
+ /*增量同步 合同段计量树*/
|
|
result = meterTreeContractService.contractTreeSync(meterTreeProjects, rootNode.getTemplateId(), Long.parseLong(contractId), Long.parseLong(projectId));
|
|
result = meterTreeContractService.contractTreeSync(meterTreeProjects, rootNode.getTemplateId(), Long.parseLong(contractId), Long.parseLong(projectId));
|
|
}
|
|
}
|
|
-
|
|
|
|
- /*加锁*/
|
|
|
|
- bladeRedis.set(redisKey, "1");
|
|
|
|
- bladeRedis.expire(redisKey, 60);
|
|
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
throw new ServiceException("未获取到项目计量单元信息!");
|
|
throw new ServiceException("未获取到项目计量单元信息!");
|
|
}
|
|
}
|
|
@@ -456,7 +493,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/left-list")
|
|
@GetMapping("/contract/left-list")
|
|
- @ApiOperationSupport(order = 21)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 22)
|
|
@ApiOperation(value = "合同段-新增/增补单元-左边节点列表", notes = "传入id")
|
|
@ApiOperation(value = "合同段-新增/增补单元-左边节点列表", notes = "传入id")
|
|
public R<List<MeterTreeProject>> leftList(@RequestParam String id) {
|
|
public R<List<MeterTreeProject>> leftList(@RequestParam String id) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
@@ -479,7 +516,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/contract/save")
|
|
@PostMapping("/contract/save")
|
|
- @ApiOperationSupport(order = 22)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 23)
|
|
@ApiOperation(value = "合同段树节点新增", notes = "传入MeterTreeContractSaveBatchDTO")
|
|
@ApiOperation(value = "合同段树节点新增", notes = "传入MeterTreeContractSaveBatchDTO")
|
|
public R<Object> contractSave(@RequestBody MeterTreeContractSaveBatchDTO dto) {
|
|
public R<Object> contractSave(@RequestBody MeterTreeContractSaveBatchDTO dto) {
|
|
if (ObjectUtil.isNotEmpty(dto.getDataList()) && dto.getDataList().size() > 0 && (dto.getRequestType().equals(1) || dto.getRequestType().equals(2))) {
|
|
if (ObjectUtil.isNotEmpty(dto.getDataList()) && dto.getDataList().size() > 0 && (dto.getRequestType().equals(1) || dto.getRequestType().equals(2))) {
|
|
@@ -491,7 +528,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/contract/update")
|
|
@PostMapping("/contract/update")
|
|
- @ApiOperationSupport(order = 23)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 24)
|
|
@ApiOperation(value = "合同段树节点修改", notes = "传入MeterTreeContractDTO")
|
|
@ApiOperation(value = "合同段树节点修改", notes = "传入MeterTreeContractDTO")
|
|
public R<Object> contractUpdate(@RequestBody MeterTreeContractDTO dto) {
|
|
public R<Object> contractUpdate(@RequestBody MeterTreeContractDTO dto) {
|
|
if (ObjectUtil.isNotEmpty(dto.getDecompositionList()) && dto.getDecompositionList().size() > 0) {
|
|
if (ObjectUtil.isNotEmpty(dto.getDecompositionList()) && dto.getDecompositionList().size() > 0) {
|
|
@@ -513,7 +550,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/detail")
|
|
@GetMapping("/contract/detail")
|
|
- @ApiOperationSupport(order = 24)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 25)
|
|
@ApiOperation(value = "合同段树节点详情", notes = "传入id")
|
|
@ApiOperation(value = "合同段树节点详情", notes = "传入id")
|
|
public R<MeterTreeContractVO> contractDetail(@RequestParam String id) {
|
|
public R<MeterTreeContractVO> contractDetail(@RequestParam String id) {
|
|
MeterTreeContract basicInfo = meterTreeContractService.getById(id);
|
|
MeterTreeContract basicInfo = meterTreeContractService.getById(id);
|
|
@@ -529,7 +566,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/lazy")
|
|
@GetMapping("/contract/lazy")
|
|
- @ApiOperationSupport(order = 25)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 26)
|
|
@ApiOperation(value = "合同段树节点懒加载", notes = "传入contractId、节点id(根节点id=0)")
|
|
@ApiOperation(value = "合同段树节点懒加载", notes = "传入contractId、节点id(根节点id=0)")
|
|
public R<List<MeterTreeContract>> contractLazy(@RequestParam String contractId, @RequestParam String id) {
|
|
public R<List<MeterTreeContract>> contractLazy(@RequestParam String contractId, @RequestParam String id) {
|
|
if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(contractId)) {
|
|
if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(contractId)) {
|
|
@@ -543,7 +580,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/same-list")
|
|
@GetMapping("/contract/same-list")
|
|
- @ApiOperationSupport(order = 26)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 27)
|
|
@ApiOperation(value = "合同段树节点同级列表", notes = "传入parentId")
|
|
@ApiOperation(value = "合同段树节点同级列表", notes = "传入parentId")
|
|
public R<List<MeterTreeContract>> contractSameList(@RequestParam String parentId) {
|
|
public R<List<MeterTreeContract>> contractSameList(@RequestParam String parentId) {
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
if (StringUtils.isNotEmpty(parentId)) {
|
|
@@ -556,7 +593,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/contract/sort")
|
|
@PostMapping("/contract/sort")
|
|
- @ApiOperationSupport(order = 27)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 28)
|
|
@ApiOperation(value = "合同段树节点同级排序", notes = "传入节点ids逗号拼接字符串,按照顺序从上到下")
|
|
@ApiOperation(value = "合同段树节点同级排序", notes = "传入节点ids逗号拼接字符串,按照顺序从上到下")
|
|
public R<Object> contractSort(@RequestBody String ids) {
|
|
public R<Object> contractSort(@RequestBody String ids) {
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
@@ -574,7 +611,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/remove")
|
|
@GetMapping("/contract/remove")
|
|
- @ApiOperationSupport(order = 28)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 29)
|
|
@ApiOperation(value = "合同段树节点删除", notes = "传入id")
|
|
@ApiOperation(value = "合同段树节点删除", notes = "传入id")
|
|
public R<Object> contractRemove(@RequestParam String id) {
|
|
public R<Object> contractRemove(@RequestParam String id) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
@@ -605,7 +642,7 @@ public class MeterTreeController extends BladeController {
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/lock")
|
|
@GetMapping("/contract/lock")
|
|
- @ApiOperationSupport(order = 29)
|
|
|
|
|
|
+ @ApiOperationSupport(order = 30)
|
|
@ApiOperation(value = "合同段树节点锁定/解锁", notes = "传入id、lockStatus=1(锁定),lockStatus=0(解锁)")
|
|
@ApiOperation(value = "合同段树节点锁定/解锁", notes = "传入id、lockStatus=1(锁定),lockStatus=0(解锁)")
|
|
public R<Object> contractLock(@RequestParam String id, @RequestParam Integer lockStatus) {
|
|
public R<Object> contractLock(@RequestParam String id, @RequestParam Integer lockStatus) {
|
|
if (StringUtils.isNotEmpty(id) && (lockStatus.equals(0) || lockStatus.equals(1))) {
|
|
if (StringUtils.isNotEmpty(id) && (lockStatus.equals(0) || lockStatus.equals(1))) {
|