|
|
@@ -0,0 +1,98 @@
|
|
|
+package com.kede.customerCase.controller;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.kede.common.bo.Result;
|
|
|
+import com.kede.common.constant.ErrorConstants;
|
|
|
+import com.kede.common.controller.BaseApiController;
|
|
|
+import com.kede.common.utils.StringUtils;
|
|
|
+import com.kede.customerCase.bo.InputCustomerCase;
|
|
|
+import com.kede.customerCase.service.CustomerCaseService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/api/admin/customerCase")
|
|
|
+public class AdminCustomerCaseApiController extends BaseApiController {
|
|
|
+ @Resource
|
|
|
+ private CustomerCaseService customerCaseService;
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping(value = "/addCustomerCase", method = RequestMethod.POST)
|
|
|
+ public Result addCustomerCase(InputCustomerCase ic) {
|
|
|
+ Result res =new Result();
|
|
|
+ if(StringUtils.isBlank(ic.getPictureUrl())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"图片","图片"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (!res.getError().isEmpty()) {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.data(customerCaseService.addCustomerCase(ic));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping(value = "/updateCustomerCase", method = RequestMethod.POST)
|
|
|
+ public Result updateCustomerCase(InputCustomerCase ic) {
|
|
|
+ Result res =new Result();
|
|
|
+ if(StringUtils.isBlank(ic.getPictureUrl())) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"图片","图片"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (!res.getError().isEmpty()) return res;
|
|
|
+
|
|
|
+ res.data(customerCaseService.updateCustomerCase(ic));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/deleteCustomerCase", method = RequestMethod.POST)
|
|
|
+ public Result deleteCustomerCase(InputCustomerCase ic) {
|
|
|
+ Result res =new Result();
|
|
|
+ if(ic.getId()==null) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"ID","ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.data(customerCaseService.deleteCustomerCase(ic));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/listCustomerCase", method = RequestMethod.GET)
|
|
|
+ public Result listCustomerCase(InputCustomerCase ic,Integer pageSize,Integer pageNo) {
|
|
|
+ Result res =new Result();
|
|
|
+
|
|
|
+ res.data(customerCaseService.listCustomerCase(ic,pageSize,pageNo));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/selectCustomerCase", method = RequestMethod.GET)
|
|
|
+ public Result selectCustomerCase(InputCustomerCase ic) {
|
|
|
+ Result res =new Result();
|
|
|
+ if(ic.getId()==null) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"ID","ID"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (!res.getError().isEmpty()) return res;
|
|
|
+ res.data(customerCaseService.selectCustomerCase(ic));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 上传图片 **/
|
|
|
+ @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
|
|
|
+ public Result uploadOrderInvoiceFile(HttpServletRequest req){
|
|
|
+ Result res = new Result();
|
|
|
+ res.setData(handleFile(res, "/customer_Case/", false, req, "customer_Case"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|