|
|
@@ -18,8 +18,8 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
/**
|
|
|
-* controller类
|
|
|
-*/
|
|
|
+ * controller类
|
|
|
+ */
|
|
|
@Controller
|
|
|
@RequestMapping("/customerService")
|
|
|
public class CustomerServiceController {
|
|
|
@@ -28,8 +28,8 @@ public class CustomerServiceController {
|
|
|
private CustomerServiceService customerServiceService;
|
|
|
|
|
|
/**
|
|
|
- * <p>获取全部记录。</p>
|
|
|
- */
|
|
|
+ * <p>获取全部记录。</p>
|
|
|
+ */
|
|
|
@RequiresAuthentication
|
|
|
@RequestMapping(value = "/all", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@@ -39,8 +39,8 @@ public class CustomerServiceController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * <p>根据Id。</p>
|
|
|
- */
|
|
|
+ * <p>根据Id。</p>
|
|
|
+ */
|
|
|
@RequestMapping(value = "/getCustomerService", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public Result getCustomerService(@RequestParam(required = false, value = "id") String id) {
|
|
|
@@ -49,8 +49,8 @@ public class CustomerServiceController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * <p>根据条件获取。</p>
|
|
|
- */
|
|
|
+ * <p>根据条件获取。</p>
|
|
|
+ */
|
|
|
@RequestMapping(value = "/getOne", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public Result getOne(CustomerService record) {
|
|
|
@@ -60,14 +60,14 @@ public class CustomerServiceController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * <p>分页查询。</p>
|
|
|
- */
|
|
|
+ * <p>分页查询。</p>
|
|
|
+ */
|
|
|
@RequestMapping(value = "/page", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public Result page(Page page, CustomerService record) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
- List<CustomerService> pp =customerServiceService.getCustomerServiceByPage(page, record);
|
|
|
+ List<CustomerService> pp = customerServiceService.getCustomerServiceByPage(page, record);
|
|
|
|
|
|
result.put(AppConstant.PAGE, page);
|
|
|
result.put("pp", pp);
|
|
|
@@ -76,90 +76,116 @@ public class CustomerServiceController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * <p>保存。</p>
|
|
|
- */
|
|
|
+ * <p>保存。</p>
|
|
|
+ */
|
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Result save(CustomerService record) {
|
|
|
boolean num = customerServiceService.createCustomerService(record);
|
|
|
if (num) {
|
|
|
- return new Result(true, record.getId());
|
|
|
+ return new Result(true, record.getId());
|
|
|
}
|
|
|
return new Result(false, "保存异常");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * <p>更新信息。</p>
|
|
|
- */
|
|
|
+ * <p>更新信息。</p>
|
|
|
+ */
|
|
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Result updateCustomerService(CustomerService record) {
|
|
|
boolean num = customerServiceService.updateCustomerService(record);
|
|
|
if (num) {
|
|
|
- return new Result(true, "保存成功");
|
|
|
+ return new Result(true, "保存成功");
|
|
|
}
|
|
|
return new Result(false, "保存异常");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * <p>删除。</p>
|
|
|
- */
|
|
|
+ * <p>删除。</p>
|
|
|
+ */
|
|
|
@RequestMapping(value = "/del", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Result deleteCustomerService(@RequestParam(required = true, value = "id") String id) {
|
|
|
|
|
|
boolean num = customerServiceService.deleteCustomerService(id);
|
|
|
if (num) {
|
|
|
- return new Result(true, "删除成功");
|
|
|
+ return new Result(true, "删除成功");
|
|
|
}
|
|
|
return new Result(false, "删除异常");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出Excel
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @param record
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
+ * 导出Excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @param record
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
@RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public void exportExcel(HttpServletRequest request, HttpServletResponse response, CustomerService record) throws Exception {
|
|
|
|
|
|
- List<CustomerService> customerServices = customerServiceService.getCustomerServiceList(record);
|
|
|
+ List<CustomerService> customerServices = customerServiceService.getCustomerServiceList(record);
|
|
|
|
|
|
|
|
|
String sheetName = "customer_service";
|
|
|
String titleName = "店铺客服数据表";
|
|
|
String fileName = "店铺客服表";
|
|
|
int columnNumber = 14;
|
|
|
- int[] columnWidth = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 };
|
|
|
- String[] columnName = { "" , "删除标识" , "更新时间" , "更新人" , "创建时间" , "创建人" , "店铺" , "客服名" , "密码" , "登录名" , "头像" , "可用标识" , "状态" , "登录时间" };
|
|
|
+ int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
|
|
|
+ String[] columnName = {"", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "店铺", "客服名", "密码", "登录名", "头像", "可用标识", "状态", "登录时间"};
|
|
|
String[][] dataList = new String[customerServices.size()][14];
|
|
|
|
|
|
for (int i = 0; i < customerServices.size(); i++) {
|
|
|
|
|
|
- dataList[i][0] = String.valueOf(customerServices.get(i).getId());
|
|
|
- dataList[i][1] = String.valueOf(customerServices.get(i).getDelFlag());
|
|
|
- dataList[i][2] = String.valueOf(customerServices.get(i).getUpdateTime());
|
|
|
- dataList[i][3] = String.valueOf(customerServices.get(i).getUpdateUser());
|
|
|
- dataList[i][4] = String.valueOf(customerServices.get(i).getCreateTime());
|
|
|
- dataList[i][5] = String.valueOf(customerServices.get(i).getCreateUser());
|
|
|
- dataList[i][6] = String.valueOf(customerServices.get(i).getStoreId());
|
|
|
- dataList[i][7] = String.valueOf(customerServices.get(i).getServiceName());
|
|
|
- dataList[i][8] = String.valueOf(customerServices.get(i).getPassword());
|
|
|
- dataList[i][9] = String.valueOf(customerServices.get(i).getUsername());
|
|
|
- dataList[i][10] = String.valueOf(customerServices.get(i).getIcon());
|
|
|
- dataList[i][11] = String.valueOf(customerServices.get(i).getUseFlag());
|
|
|
- dataList[i][12] = String.valueOf(customerServices.get(i).getStatusFlag());
|
|
|
- dataList[i][13] = String.valueOf(customerServices.get(i).getLoginTime());
|
|
|
- }
|
|
|
+ dataList[i][0] = String.valueOf(customerServices.get(i).getId());
|
|
|
+ dataList[i][1] = String.valueOf(customerServices.get(i).getDelFlag());
|
|
|
+ dataList[i][2] = String.valueOf(customerServices.get(i).getUpdateTime());
|
|
|
+ dataList[i][3] = String.valueOf(customerServices.get(i).getUpdateUser());
|
|
|
+ dataList[i][4] = String.valueOf(customerServices.get(i).getCreateTime());
|
|
|
+ dataList[i][5] = String.valueOf(customerServices.get(i).getCreateUser());
|
|
|
+ dataList[i][6] = String.valueOf(customerServices.get(i).getStoreId());
|
|
|
+ dataList[i][7] = String.valueOf(customerServices.get(i).getServiceName());
|
|
|
+ dataList[i][8] = String.valueOf(customerServices.get(i).getPassword());
|
|
|
+ dataList[i][9] = String.valueOf(customerServices.get(i).getUsername());
|
|
|
+ dataList[i][10] = String.valueOf(customerServices.get(i).getIcon());
|
|
|
+ dataList[i][11] = String.valueOf(customerServices.get(i).getUseFlag());
|
|
|
+ dataList[i][12] = String.valueOf(customerServices.get(i).getStatusFlag());
|
|
|
+ dataList[i][13] = String.valueOf(customerServices.get(i).getLoginTime());
|
|
|
+ }
|
|
|
|
|
|
|
|
|
ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
|
|
|
- columnNumber, columnWidth, columnName, dataList, response);
|
|
|
+ columnNumber, columnWidth, columnName, dataList, response);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Result login(@RequestParam(required = true, value = "username") String username, @RequestParam(required = true, value = "password") String password) {
|
|
|
+
|
|
|
+ CustomerService record = new CustomerService();
|
|
|
+ record.setUsername(username);
|
|
|
+ record.setPassword(password);
|
|
|
+
|
|
|
+ record = customerServiceService.getCustomerService(record);
|
|
|
|
|
|
+ if (record != null) {
|
|
|
+ CustomerService update = new CustomerService();
|
|
|
+ update.setId(record.getId());
|
|
|
+ update.setLoginTime(new Date());
|
|
|
|
|
|
+ customerServiceService.updateCustomerService(update);
|
|
|
+
|
|
|
+ return new Result(true, record);
|
|
|
}
|
|
|
+
|
|
|
+ return new Result(false, "用户名或密码错误");
|
|
|
}
|
|
|
|
|
|
+}
|
|
|
+
|