|
@@ -7,6 +7,8 @@ import com.jpsoft.picc.modules.common.dto.Sort;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
import com.jpsoft.picc.modules.common.dto.MessageResult;
|
|
import com.jpsoft.picc.modules.base.service.CompanyService;
|
|
import com.jpsoft.picc.modules.base.service.CompanyService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -25,57 +27,16 @@ public class CompanyController {
|
|
@Autowired
|
|
@Autowired
|
|
private CompanyService companyService;
|
|
private CompanyService companyService;
|
|
|
|
|
|
- @ApiOperation(value="创建空记录")
|
|
|
|
- @GetMapping("create")
|
|
|
|
- public MessageResult<Company> create(){
|
|
|
|
- MessageResult<Company> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- Company company = new Company();
|
|
|
|
-
|
|
|
|
- msgResult.setData(company);
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
|
- @PostMapping("add")
|
|
|
|
- public MessageResult<Company> add(@RequestBody Company company,@RequestAttribute String subject){
|
|
|
|
- MessageResult<Company> msgResult = new MessageResult<>();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- company.setId(UUID.randomUUID().toString());
|
|
|
|
- company.setDelFlag(false);
|
|
|
|
- company.setCreateBy(subject);
|
|
|
|
- company.setCreateTime(new Date());
|
|
|
|
-
|
|
|
|
- int affectCount = companyService.insert(company);
|
|
|
|
-
|
|
|
|
- if (affectCount > 0) {
|
|
|
|
- msgResult.setResult(true);
|
|
|
|
- msgResult.setData(company);
|
|
|
|
- } else {
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage("数据库添加失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch(Exception ex){
|
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
|
-
|
|
|
|
- msgResult.setResult(false);
|
|
|
|
- msgResult.setMessage(ex.getMessage());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msgResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@ApiOperation(value="获取信息")
|
|
@ApiOperation(value="获取信息")
|
|
- @GetMapping("edit/{id}")
|
|
|
|
- public MessageResult<Company> edit(@PathVariable("id") String id){
|
|
|
|
|
|
+ @GetMapping("detail")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "companyId",value = "企业编号", required = true, paramType = "query")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Company> detail(String companyId){
|
|
MessageResult<Company> msgResult = new MessageResult<>();
|
|
MessageResult<Company> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
- Company company = companyService.get(id);
|
|
|
|
|
|
+ Company company = companyService.get(companyId);
|
|
|
|
|
|
if (company != null) {
|
|
if (company != null) {
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
@@ -95,8 +56,9 @@ public class CompanyController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
|
- @PostMapping("update")
|
|
|
|
|
|
+// @ApiOperation(value="更新企业信息")
|
|
|
|
+// @PostMapping("update")
|
|
|
|
+ @Deprecated
|
|
public MessageResult<Company> update(@RequestBody Company company,@RequestAttribute String subject){
|
|
public MessageResult<Company> update(@RequestBody Company company,@RequestAttribute String subject){
|
|
MessageResult<Company> msgResult = new MessageResult<>();
|
|
MessageResult<Company> msgResult = new MessageResult<>();
|
|
|
|
|
|
@@ -124,8 +86,9 @@ public class CompanyController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="删除")
|
|
|
|
- @PostMapping("delete/{id}")
|
|
|
|
|
|
+// @ApiOperation(value="删除")
|
|
|
|
+// @PostMapping("delete/{id}")
|
|
|
|
+ @Deprecated
|
|
public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
|
|
@@ -156,8 +119,9 @@ public class CompanyController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="批量删除")
|
|
|
|
- @PostMapping("batchDelete")
|
|
|
|
|
|
+// @ApiOperation(value="批量删除")
|
|
|
|
+// @PostMapping("batchDelete")
|
|
|
|
+ @Deprecated
|
|
public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
|
|
@@ -193,8 +157,14 @@ public class CompanyController {
|
|
|
|
|
|
@ApiOperation(value="列表")
|
|
@ApiOperation(value="列表")
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "name",value = "企业名称", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "legalName",value = "法人代表", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "usccCode",value = "证件编号", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject",value = "当前用户编号(系统自动获取,不用填写)")
|
|
|
|
+ })
|
|
public MessageResult<Map> pageList(
|
|
public MessageResult<Map> pageList(
|
|
- String id,
|
|
|
|
|
|
+ String name,String legalName,String usccCode,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
@RequestAttribute String subject){
|
|
@RequestAttribute String subject){
|
|
@@ -207,10 +177,18 @@ public class CompanyController {
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
+ sortList.add(new Sort("create_time","asc"));
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
|
+ searchParams.put("name","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(legalName)) {
|
|
|
|
+ searchParams.put("legalName","%" + legalName + "%");
|
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(usccCode)) {
|
|
|
|
+ searchParams.put("usccCode","%" + usccCode + "%");
|
|
}
|
|
}
|
|
|
|
|
|
Page<Company> page = companyService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|
|
Page<Company> page = companyService.pageSearch(searchParams,pageIndex,pageSize,sortList);
|