Commit 0bdd5ca4 authored by zhaochengming's avatar zhaochengming

赵呈明

parent 94f60d41
...@@ -42,9 +42,13 @@ public class OcpApiTreeController { ...@@ -42,9 +42,13 @@ public class OcpApiTreeController {
@PostMapping("/instertree") @PostMapping("/instertree")
@ApiOperation("服务树分类--新增") @ApiOperation("服务树分类--新增")
public ResponseVO inseter(@RequestBody OcpApiGroupDtos ocpApiGroupDtos){ public ResponseVO inseter(@RequestBody OcpApiGroupDtos ocpApiGroupDtos){
service.insertTree(ocpApiGroupDtos); boolean flag = service.insertTree(ocpApiGroupDtos);
if (flag){
return ResponseVO.ok(); return ResponseVO.ok();
} }
return ResponseVO.error("您的服务编码重复,请重新输入");
}
@PostMapping("/updatatree") @PostMapping("/updatatree")
@ApiOperation("服务树分类--修改") @ApiOperation("服务树分类--修改")
public ResponseVO updataTree(@RequestBody OcpApiGroup ocpApiGroup){ public ResponseVO updataTree(@RequestBody OcpApiGroup ocpApiGroup){
...@@ -56,7 +60,7 @@ public class OcpApiTreeController { ...@@ -56,7 +60,7 @@ public class OcpApiTreeController {
public ResponseVO deleteTree(@RequestBody OcpApiGroup ocpApiGroup){ public ResponseVO deleteTree(@RequestBody OcpApiGroup ocpApiGroup){
boolean tree = service.deleteOcpTree(ocpApiGroup); boolean tree = service.deleteOcpTree(ocpApiGroup);
if (tree){ if (tree){
return ResponseVO.ok(); return ResponseVO.ok("删除成功!");
}else { }else {
return ResponseVO.error("请先删除下级目录"); return ResponseVO.error("请先删除下级目录");
} }
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
public class ApiTreeGroupDto { public class ApiTreeGroupDto {
@ApiModelProperty("一级") @ApiModelProperty("一级")
private List<OneTreeUpList> oneupList; private List<OneTreeUpList> oneList;
@ApiModelProperty("二级") @ApiModelProperty("二级")
...@@ -21,11 +21,11 @@ public class ApiTreeGroupDto { ...@@ -21,11 +21,11 @@ public class ApiTreeGroupDto {
private List<ThreeTreeList> ThreeList; private List<ThreeTreeList> ThreeList;
public List<OneTreeUpList> getOneupList() { public List<OneTreeUpList> getOneupList() {
return oneupList; return oneList;
} }
public void setOneupList(List<OneTreeUpList> oneupList) { public void setOneupList(List<OneTreeUpList> oneupList) {
this.oneupList = oneupList; this.oneList = oneupList;
} }
public List<TwoDownList> getTwoList() { public List<TwoDownList> getTwoList() {
......
...@@ -17,7 +17,7 @@ public interface OcpApiTreeService extends IService<OcpApiGroup> { ...@@ -17,7 +17,7 @@ public interface OcpApiTreeService extends IService<OcpApiGroup> {
/** /**
* 新增服务分类 * 新增服务分类
*/ */
void insertTree(OcpApiGroupDtos ocpApiGroupDtos); boolean insertTree(OcpApiGroupDtos ocpApiGroupDtos);
/* /*
......
...@@ -50,8 +50,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -50,8 +50,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
//一级服务分类 //一级服务分类
List<OneTreeUpList> oneTreeUpLists = new ArrayList<>(); List<OneTreeUpList> oneTreeUpLists = new ArrayList<>();
for (OcpApiGroup ocpApiGroup : ocpApiGroups) { for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
//判断数据状态 //判断数据状态
if (!(ocpApiGroup.getIsDelete() == 0)) { if (!(ocpApiGroup.getIsDelete() == 0)) {
...@@ -95,12 +93,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -95,12 +93,6 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
BeanUtils.copyProperties(ocpApiGroup,twoDownList); BeanUtils.copyProperties(ocpApiGroup,twoDownList);
twoTreeLists.add(twoDownList); twoTreeLists.add(twoDownList);
/* String apiGroupCode = ocpApiGroup.getApiGroupCode();
String apiGroupName = ocpApiGroup.getApiGroupName();
twoDownList.setCode(apiGroupCode);
twoDownList.setpName(apiGroupName);
twoDownList.setDownList(ocpApiGroup);
threeTreeLists.add(twoDownList);*/
} }
} }
} }
...@@ -140,42 +132,35 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -140,42 +132,35 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
* @param ocpApiGroupDtos * @param ocpApiGroupDtos
*/ */
@Override @Override
public void insertTree(OcpApiGroupDtos ocpApiGroupDtos) { public boolean insertTree(OcpApiGroupDtos ocpApiGroupDtos) {
boolean flag = true;
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null);
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
if (ocpApiGroup.getApiGroupCode().equals(ocpApiGroupDtos.getApiGroupCode())){
flag = false;
break;
}
}
if (flag == true) {
OcpApiBase ocpApiBase = new OcpApiBase(); OcpApiBase ocpApiBase = new OcpApiBase();
ocpApiBase.setApiCode(ocpApiGroupDtos.getApiGroupCode()); ocpApiBase.setApiCode(ocpApiGroupDtos.getApiGroupCode());
// ocpApiBase.setApiMtime(new Date("yyyy-MM-dd").getTime()); BeanUtils.copyProperties(ocpApiGroupDtos, ocpApiBase);
BeanUtils.copyProperties(ocpApiGroupDtos,ocpApiBase);
ocpApiBase.setApiName("新增服务分类"); ocpApiBase.setApiName("新增服务分类");
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ocpApiBase.setApiMtime(timestamp); ocpApiBase.setApiMtime(timestamp);
ocpApiBase.setApiCtime(ocpApiGroupDtos.getApiGroupCtime()); ocpApiBase.setApiCtime(ocpApiGroupDtos.getApiGroupCtime());
ocpApiBase.setApiUserId(ocpApiGroupDtos.getApiGroupUserId()); ocpApiBase.setApiUserId(ocpApiGroupDtos.getApiGroupUserId());
ocpApiBase.setObjId(""); ocpApiBase.setObjId("");
/* ocpApiBase.setApiCode(ocpApiGroupDtos.getApiGroupCode()); OcpApiGroup ocpApiGroup1 = new OcpApiGroup();
ocpApiBase.setApiName(ocpApiGroupDtos.getApiGroupName()); ocpApiGroup1.setObjId("");
ocpApiBase.setApiGroupCode(ocpApiGroupDtos.getApiGroupPcode()); BeanUtils.copyProperties(ocpApiGroupDtos, ocpApiGroup1);
ocpApiBase.setApiPromotion(ocpApiGroupDtos.getApiGroupPromotionType());
ocpApiBase.setApiReq(ocpApiGroupDtos.getApiReq());
ocpApiBase.setApiResp(ocpApiGroupDtos.getApiResp());
ocpApiBase.setApiUrl(ocpApiBase.getApiUrl());
ocpApiBase.setApiCtime(ocpApiGroupDtos.getApiGroupCtime());
ocpApiBase.setApiMtime(new Date("yyyy-MM-dd").getTime());
ocpApiBase.setApiUserId(ocpApiGroupDtos.getApiGroupUserId());
ocpApiBase.setApiUnit(ocpApiGroupDtos.getOwnerCompanyCode());
ocpApiBase.setOwnerCompanyCode(ocpApiGroupDtos.getOwnerCompanyCode());
ocpApiBase.setOwnerCompanyName(ocpApiGroupDtos.getOwnerCompanyCode());
ocpApiBase.setIsDelete(ocpApiGroupDtos.getIsDelete());*/
OcpApiGroup ocpApiGroup = new OcpApiGroup();
ocpApiGroup.setObjId("");
BeanUtils.copyProperties(ocpApiGroupDtos,ocpApiGroup);
ocpApiBaseMapper.insert(ocpApiBase); ocpApiBaseMapper.insert(ocpApiBase);
mapper.insert(ocpApiGroup); mapper.insert(ocpApiGroup1);
}
return flag;
} }
......
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