|
@@ -1,5 +1,7 @@
|
|
package com.steerinfo.ftp.securitytype.controller;
|
|
package com.steerinfo.ftp.securitytype.controller;
|
|
|
|
|
|
|
|
+import com.steerinfo.auth.utils.JwtUtil;
|
|
|
|
+import com.steerinfo.ems.Utils.TreeUtils;
|
|
import com.steerinfo.framework.controller.BaseRESTfulController;
|
|
import com.steerinfo.framework.controller.BaseRESTfulController;
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
import com.steerinfo.framework.service.pagehelper.PageList;
|
|
import com.steerinfo.framework.service.pagehelper.PageList;
|
|
@@ -9,16 +11,13 @@ import com.steerinfo.ftp.securitytype.service.ISecurityTypeService;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* SecurityType RESTful接口:
|
|
* SecurityType RESTful接口:
|
|
@@ -69,6 +68,21 @@ public class SecurityTypeController extends BaseRESTfulController {
|
|
//@RequiresPermissions("securitytype:create")
|
|
//@RequiresPermissions("securitytype:create")
|
|
@PostMapping(value = "/")
|
|
@PostMapping(value = "/")
|
|
public RESTfulResult add(@ModelAttribute SecurityType model){
|
|
public RESTfulResult add(@ModelAttribute SecurityType model){
|
|
|
|
+
|
|
|
|
+ if(model.getSecurityName() == null || "".equals(model.getSecurityName())){
|
|
|
|
+ return failed(null, "名称不能为空");
|
|
|
|
+ }
|
|
|
|
+ else if (model.getSeqno()==0||model.getSeqno()==null){
|
|
|
|
+ Long seqno = new Long(securityTypeService.getMaxSeqNo()+1);
|
|
|
|
+ model.setSeqno(seqno);
|
|
|
|
+ }
|
|
|
|
+ String url = "";
|
|
|
|
+ if(model.getSecurityParentid() != null && !"".equals(model.getSecurityParentid())){
|
|
|
|
+ url=securityTypeService.getURL(model.getParentId());
|
|
|
|
+ }
|
|
|
|
+ model.setCreateMan(JwtUtil.getUseridByToken());
|
|
|
|
+ model.setCreateTime(new Date());
|
|
|
|
+ model.setSecurityUploadUrl(url+"/"+model.getSecurityName());
|
|
SecurityType securityType = securityTypeService.add(model);
|
|
SecurityType securityType = securityTypeService.add(model);
|
|
return success(securityType);
|
|
return success(securityType);
|
|
}
|
|
}
|
|
@@ -94,6 +108,28 @@ public class SecurityTypeController extends BaseRESTfulController {
|
|
SecurityType securityType = securityTypeService.modify(model);
|
|
SecurityType securityType = securityTypeService.modify(model);
|
|
return success(securityType);
|
|
return success(securityType);
|
|
}
|
|
}
|
|
|
|
+ @PutMapping(value = "/batchupdate", produces = "application/json;charset=UTF-8")
|
|
|
|
+ public RESTfulResult batchupdate(@RequestBody SecurityType[] models) {
|
|
|
|
+ String userId = JwtUtil.getUseridByToken();
|
|
|
|
+ for (int i = 0; i < models.length; i++) {
|
|
|
|
+ SecurityType model = models[i];
|
|
|
|
+ if (model.getId() == null || model.getId().equals("")) {
|
|
|
|
+ return failed(null, "id为空");
|
|
|
|
+ }
|
|
|
|
+ if (model.getSecurityName() == null || model.getSecurityName().equals("")) {
|
|
|
|
+ return failed(null, "名称为空");
|
|
|
|
+ }
|
|
|
|
+ String url = "";
|
|
|
|
+ if(model.getSecurityParentid() != null && !"".equals(model.getSecurityParentid())){
|
|
|
|
+ url=securityTypeService.getURL(model.getParentId());
|
|
|
|
+ }
|
|
|
|
+ model.setSecurityUploadUrl(url+"/"+model.getSecurityName());
|
|
|
|
+ model.setUpdateMan(userId);
|
|
|
|
+ model.setUpdateTime(new Date());
|
|
|
|
+ securityTypeService.modify(model);
|
|
|
|
+ }
|
|
|
|
+ return success();
|
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value="删除", notes="根据url的id来指定删除对象")
|
|
@ApiOperation(value="删除", notes="根据url的id来指定删除对象")
|
|
@ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
|
|
@ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
|
|
@@ -107,4 +143,33 @@ public class SecurityTypeController extends BaseRESTfulController {
|
|
}
|
|
}
|
|
return success();
|
|
return success();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="获取上层节点", notes="查询上层节点名字和id")
|
|
|
|
+ @GetMapping(value = "/getparent/", produces = "application/json;charset=UTF-8")
|
|
|
|
+ public RESTfulResult getParent(){
|
|
|
|
+ List<SecurityType> tRmWorkproc = securityTypeService.getParent();
|
|
|
|
+ return success(tRmWorkproc);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="获取树状数据", notes="获取TRmWorkproc的树形数据")
|
|
|
|
+ @GetMapping(value = "/gettree/")
|
|
|
|
+ public RESTfulResult getTree(@RequestParam HashMap parameters){
|
|
|
|
+ TreeUtils treeUtils = new TreeUtils();
|
|
|
|
+ List<SecurityType> list = securityTypeService.getTree(parameters);
|
|
|
|
+ return success(treeUtils.getTreeData(list));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "查询下拉框的值",notes = "根据 namd 和 id 来显示,可传参数ISSETTLE(列入结算),ISREAL(列入实绩),ISPLAN(列入计划),ISBALANCE(列入平衡表),HASPRODUCT(是否产出)")
|
|
|
|
+ @GetMapping("/getIdAndName")
|
|
|
|
+ public RESTfulResult getIdAndName(@RequestParam HashMap<String, Object> parmas){
|
|
|
|
+ if(parmas.get("id") != null && !parmas.get("id").toString().isEmpty()){
|
|
|
|
+ String id = parmas.get("id").toString();
|
|
|
|
+ if(!id.startsWith("'")){
|
|
|
|
+ id = "'" + id.replaceAll(",", "','").replaceAll(",", "','") + "'";
|
|
|
|
+ }
|
|
|
|
+ parmas.put("id", id);
|
|
|
|
+ }
|
|
|
|
+ List<SecurityType> idAndName = securityTypeService.getIdAndName(parmas);
|
|
|
|
+ return success(idAndName);
|
|
|
|
+ }
|
|
}
|
|
}
|