|
@@ -2,8 +2,11 @@ package com.lframework.xingyun.basedata.controller; |
|
@@ -2,8 +2,11 @@ package com.lframework.xingyun.basedata.controller; |
|
2
|
|
2
|
|
|
3
|
import com.lframework.starter.web.core.annotations.security.HasPermission;
|
3
|
import com.lframework.starter.web.core.annotations.security.HasPermission;
|
|
4
|
import com.lframework.starter.web.core.controller.DefaultBaseController;
|
4
|
import com.lframework.starter.web.core.controller.DefaultBaseController;
|
|
|
|
5
|
+import com.lframework.starter.web.core.utils.ExcelUtil;
|
|
5
|
import com.lframework.xingyun.basedata.bo.customer.GetCustomerShortBo;
|
6
|
import com.lframework.xingyun.basedata.bo.customer.GetCustomerShortBo;
|
|
6
|
import com.lframework.xingyun.basedata.bo.customer.QueryCustomerShortBo;
|
7
|
import com.lframework.xingyun.basedata.bo.customer.QueryCustomerShortBo;
|
|
|
|
8
|
+import com.lframework.xingyun.basedata.excel.customer.CustomerShortImportListener;
|
|
|
|
9
|
+import com.lframework.xingyun.basedata.excel.customer.CustomerShortModel;
|
|
7
|
import com.lframework.xingyun.basedata.vo.customer.QueryCustomerShortVo;
|
10
|
import com.lframework.xingyun.basedata.vo.customer.QueryCustomerShortVo;
|
|
8
|
import com.lframework.xingyun.basedata.service.customer.CustomerShortService;
|
11
|
import com.lframework.xingyun.basedata.service.customer.CustomerShortService;
|
|
9
|
import com.lframework.xingyun.basedata.vo.customer.CreateCustomerShortVo;
|
12
|
import com.lframework.xingyun.basedata.vo.customer.CreateCustomerShortVo;
|
|
@@ -24,8 +27,10 @@ import io.swagger.annotations.Api; |
|
@@ -24,8 +27,10 @@ import io.swagger.annotations.Api; |
|
24
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
27
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
25
|
import org.springframework.validation.annotation.Validated;
|
28
|
import org.springframework.validation.annotation.Validated;
|
|
26
|
import org.springframework.web.bind.annotation.*;
|
29
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
30
|
+import org.springframework.web.multipart.MultipartFile;
|
|
27
|
|
31
|
|
|
28
|
import javax.validation.Valid;
|
32
|
import javax.validation.Valid;
|
|
|
|
33
|
+import javax.validation.constraints.NotNull;
|
|
29
|
import java.util.List;
|
34
|
import java.util.List;
|
|
30
|
import java.util.stream.Collectors;
|
35
|
import java.util.stream.Collectors;
|
|
31
|
|
36
|
|
|
@@ -50,7 +55,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
@@ -50,7 +55,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
50
|
* 查询列表
|
55
|
* 查询列表
|
|
51
|
*/
|
56
|
*/
|
|
52
|
@ApiOperation("查询列表")
|
57
|
@ApiOperation("查询列表")
|
|
53
|
- @HasPermission({"customer:customer:query"})
|
58
|
+ @HasPermission({"base-data:custome-abbreviation:query"})
|
|
54
|
@GetMapping("/query")
|
59
|
@GetMapping("/query")
|
|
55
|
public InvokeResult<PageResult<QueryCustomerShortBo>> query(@Valid QueryCustomerShortVo vo) {
|
60
|
public InvokeResult<PageResult<QueryCustomerShortBo>> query(@Valid QueryCustomerShortVo vo) {
|
|
56
|
PageResult<CustomerShort> pageResult = customerShortService.query(getPageIndex(vo), getPageSize(vo), vo);
|
61
|
PageResult<CustomerShort> pageResult = customerShortService.query(getPageIndex(vo), getPageSize(vo), vo);
|
|
@@ -67,7 +72,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
@@ -67,7 +72,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
67
|
*/
|
72
|
*/
|
|
68
|
@ApiOperation("根据ID查询")
|
73
|
@ApiOperation("根据ID查询")
|
|
69
|
@ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
|
74
|
@ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
|
|
70
|
- @HasPermission({"customer:customer:query"})
|
75
|
+ @HasPermission({"base-data:custome-abbreviation:query"})
|
|
71
|
@GetMapping
|
76
|
@GetMapping
|
|
72
|
public InvokeResult<GetCustomerShortBo> get(@NotBlank(message = "id不能为空!") String id) {
|
77
|
public InvokeResult<GetCustomerShortBo> get(@NotBlank(message = "id不能为空!") String id) {
|
|
73
|
CustomerShort data = customerShortService.findById(id);
|
78
|
CustomerShort data = customerShortService.findById(id);
|
|
@@ -83,7 +88,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
@@ -83,7 +88,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
83
|
* 新增
|
88
|
* 新增
|
|
84
|
*/
|
89
|
*/
|
|
85
|
@ApiOperation("新增")
|
90
|
@ApiOperation("新增")
|
|
86
|
- @HasPermission({"customer:customer:add"})
|
91
|
+ @HasPermission({"base-data:custome-abbreviation:add"})
|
|
87
|
@PostMapping
|
92
|
@PostMapping
|
|
88
|
public InvokeResult<Void> create(@Valid CreateCustomerShortVo vo) {
|
93
|
public InvokeResult<Void> create(@Valid CreateCustomerShortVo vo) {
|
|
89
|
customerShortService.create(vo);
|
94
|
customerShortService.create(vo);
|
|
@@ -94,7 +99,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
@@ -94,7 +99,7 @@ public class CustomerShortController extends DefaultBaseController { |
|
94
|
* 修改
|
99
|
* 修改
|
|
95
|
*/
|
100
|
*/
|
|
96
|
@ApiOperation("修改")
|
101
|
@ApiOperation("修改")
|
|
97
|
- @HasPermission({"customer:customer:modify"})
|
102
|
+ @HasPermission({"base-data:custome-abbreviation:modify"})
|
|
98
|
@PutMapping
|
103
|
@PutMapping
|
|
99
|
public InvokeResult<Void> update(@Valid UpdateCustomerShortVo vo) {
|
104
|
public InvokeResult<Void> update(@Valid UpdateCustomerShortVo vo) {
|
|
100
|
customerShortService.update(vo);
|
105
|
customerShortService.update(vo);
|
|
@@ -106,10 +111,38 @@ public class CustomerShortController extends DefaultBaseController { |
|
@@ -106,10 +111,38 @@ public class CustomerShortController extends DefaultBaseController { |
|
106
|
*/
|
111
|
*/
|
|
107
|
@ApiOperation("根据ID删除")
|
112
|
@ApiOperation("根据ID删除")
|
|
108
|
@ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
|
113
|
@ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
|
|
109
|
- @HasPermission({"customer:customer:delete"})
|
114
|
+ @HasPermission({"base-data:custome-abbreviation:delete"})
|
|
110
|
@DeleteMapping
|
115
|
@DeleteMapping
|
|
111
|
public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) {
|
116
|
public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) {
|
|
112
|
customerShortService.deleteById(id);
|
117
|
customerShortService.deleteById(id);
|
|
113
|
return InvokeResultBuilder.success();
|
118
|
return InvokeResultBuilder.success();
|
|
114
|
}
|
119
|
}
|
|
|
|
120
|
+
|
|
|
|
121
|
+ /**
|
|
|
|
122
|
+ * 下载导入模板
|
|
|
|
123
|
+ */
|
|
|
|
124
|
+ @ApiOperation("下载导入模板")
|
|
|
|
125
|
+ @HasPermission({"base-data:custome-abbreviation:import"})
|
|
|
|
126
|
+ @GetMapping("/import/template")
|
|
|
|
127
|
+ public void downloadImportTemplate() {
|
|
|
|
128
|
+ ExcelUtil.exportXls("客户简称导入模板", CustomerShortModel.class);
|
|
|
|
129
|
+ }
|
|
|
|
130
|
+
|
|
|
|
131
|
+ /**
|
|
|
|
132
|
+ * 导入
|
|
|
|
133
|
+ *
|
|
|
|
134
|
+ * @param id 任务ID
|
|
|
|
135
|
+ * @param file 文件
|
|
|
|
136
|
+ */
|
|
|
|
137
|
+ @ApiOperation("导入")
|
|
|
|
138
|
+ @HasPermission({"base-data:custome-abbreviation:import"})
|
|
|
|
139
|
+ @PostMapping("/import")
|
|
|
|
140
|
+ public InvokeResult<Void> importExcel(@NotBlank(message = "ID不能为空") String id,
|
|
|
|
141
|
+ @NotNull(message = "请上传文件") MultipartFile file) {
|
|
|
|
142
|
+ CustomerShortImportListener listener = new CustomerShortImportListener();
|
|
|
|
143
|
+ listener.setTaskId(id);
|
|
|
|
144
|
+ ExcelUtil.read(file, CustomerShortModel.class, listener).sheet().doRead();
|
|
|
|
145
|
+
|
|
|
|
146
|
+ return InvokeResultBuilder.success();
|
|
|
|
147
|
+ }
|
|
115
|
} |
148
|
} |