|
@@ -8,12 +8,15 @@ import com.zksy.common.enums.BusinessType;
|
|
|
import com.zksy.common.utils.StringUtils;
|
|
import com.zksy.common.utils.StringUtils;
|
|
|
import com.zksy.common.utils.file.ExcelUtils;
|
|
import com.zksy.common.utils.file.ExcelUtils;
|
|
|
import com.zksy.system.basicData.domain.OwLeavingMessage;
|
|
import com.zksy.system.basicData.domain.OwLeavingMessage;
|
|
|
|
|
+import com.zksy.system.basicData.domain.dto.OwLeavingMessageDTO;
|
|
|
import com.zksy.system.basicData.service.CaptchaService;
|
|
import com.zksy.system.basicData.service.CaptchaService;
|
|
|
import com.zksy.system.basicData.service.OwLeavingMessageService;
|
|
import com.zksy.system.basicData.service.OwLeavingMessageService;
|
|
|
import com.zksy.utils.DowntemplateUtil;
|
|
import com.zksy.utils.DowntemplateUtil;
|
|
|
import com.zksy.utils.SearchUtil;
|
|
import com.zksy.utils.SearchUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.aspectj.weaver.loadtime.Aj;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
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 org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -21,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -32,7 +36,7 @@ import java.util.List;
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/owLeavingMessage")
|
|
@RequestMapping("/owLeavingMessage")
|
|
|
@Api(tags = "官网留言", description = "官网留言desc")
|
|
@Api(tags = "官网留言", description = "官网留言desc")
|
|
|
-public class OwLeavingMessageController extends BaseController{
|
|
|
|
|
|
|
+public class OwLeavingMessageController extends BaseController {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OwLeavingMessageService service;
|
|
private OwLeavingMessageService service;
|
|
@@ -62,19 +66,21 @@ public class OwLeavingMessageController extends BaseController{
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
|
@ApiOperation(value = "官网留言新增")
|
|
@ApiOperation(value = "官网留言新增")
|
|
|
- @Log(title = "新增官网留言", businessType = BusinessType.INSERT)
|
|
|
|
|
- public AjaxResult save(@RequestBody OwLeavingMessage owLeavingMessage) {
|
|
|
|
|
- if (owLeavingMessage.getNeedAuthCode()) {
|
|
|
|
|
- String msg = captchaService.checkImageCode(owLeavingMessage.getImageKey(),owLeavingMessage.getImageCode());
|
|
|
|
|
- if (StringUtils.isNotBlank(msg)) {
|
|
|
|
|
- return AjaxResult.error(msg);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// @Log(title = "新增官网留言", businessType = BusinessType.INSERT)
|
|
|
|
|
+ public AjaxResult save(@RequestBody OwLeavingMessageDTO dto) {
|
|
|
|
|
+// if (dto.getNeedAuthCode()) {
|
|
|
|
|
+ String msg = captchaService.checkImageCode(dto.getImageKey(), dto.getImageCode());
|
|
|
|
|
+ if (StringUtils.isNotBlank(msg)) {
|
|
|
|
|
+ return AjaxResult.error(999,msg);
|
|
|
}
|
|
}
|
|
|
|
|
+// }
|
|
|
|
|
+ OwLeavingMessage owLeavingMessage = new OwLeavingMessage();
|
|
|
|
|
+ BeanUtils.copyProperties(dto, owLeavingMessage);
|
|
|
owLeavingMessage.setCreateTime(new Date());
|
|
owLeavingMessage.setCreateTime(new Date());
|
|
|
Boolean flag = service.save(owLeavingMessage);
|
|
Boolean flag = service.save(owLeavingMessage);
|
|
|
- if(flag){
|
|
|
|
|
|
|
+ if (flag) {
|
|
|
return AjaxResult.success("留言成功");
|
|
return AjaxResult.success("留言成功");
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
return AjaxResult.success("留言失败");
|
|
return AjaxResult.success("留言失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -96,21 +102,20 @@ public class OwLeavingMessageController extends BaseController{
|
|
|
@ApiOperation("官网留言导入")
|
|
@ApiOperation("官网留言导入")
|
|
|
@Log(title = "官网留言", businessType = BusinessType.IMPORT)
|
|
@Log(title = "官网留言", businessType = BusinessType.IMPORT)
|
|
|
@PostMapping("/importData")
|
|
@PostMapping("/importData")
|
|
|
- public AjaxResult importData(MultipartFile file)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult importData(MultipartFile file) {
|
|
|
try {
|
|
try {
|
|
|
List<OwLeavingMessage> owLeavingMessageAll = service.list();
|
|
List<OwLeavingMessage> owLeavingMessageAll = service.list();
|
|
|
- List<OwLeavingMessage> list = ExcelUtils.readMultipartFile(file, OwLeavingMessage.class,OwLeavingMessage.class.getDeclaredFields().length - 2);
|
|
|
|
|
- if(owLeavingMessageAll != null && owLeavingMessageAll.size() > 0){
|
|
|
|
|
|
|
+ List<OwLeavingMessage> list = ExcelUtils.readMultipartFile(file, OwLeavingMessage.class, OwLeavingMessage.class.getDeclaredFields().length - 2);
|
|
|
|
|
+ if (owLeavingMessageAll != null && owLeavingMessageAll.size() > 0) {
|
|
|
//return AjaxResult.error("数据已存在,如需重新导入请清空数据");
|
|
//return AjaxResult.error("数据已存在,如需重新导入请清空数据");
|
|
|
}
|
|
}
|
|
|
- if(list.size() > 0){
|
|
|
|
|
|
|
+ if (list.size() > 0) {
|
|
|
service.saveBatch(list);
|
|
service.saveBatch(list);
|
|
|
- return success("导入成功,共计:"+list.size()+"条");
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ return success("导入成功,共计:" + list.size() + "条");
|
|
|
|
|
+ } else {
|
|
|
return AjaxResult.error("无数据");
|
|
return AjaxResult.error("无数据");
|
|
|
}
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
return AjaxResult.error("导入数据失败");
|
|
return AjaxResult.error("导入数据失败");
|
|
|
}
|
|
}
|
|
@@ -119,12 +124,12 @@ public class OwLeavingMessageController extends BaseController{
|
|
|
@ApiOperation("官网留言导出")
|
|
@ApiOperation("官网留言导出")
|
|
|
@Log(title = "官网留言", businessType = BusinessType.EXPORT)
|
|
@Log(title = "官网留言", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/exportData")
|
|
@PostMapping("/exportData")
|
|
|
- public AjaxResult exportData(HttpServletResponse response, String conditionJson){
|
|
|
|
|
|
|
+ public AjaxResult exportData(HttpServletResponse response, String conditionJson) {
|
|
|
try {
|
|
try {
|
|
|
List<OwLeavingMessage> wrapperList = service.list(SearchUtil.parseWhereSql(conditionJson));
|
|
List<OwLeavingMessage> wrapperList = service.list(SearchUtil.parseWhereSql(conditionJson));
|
|
|
- ExcelUtils.export(response,"官网留言",wrapperList,OwLeavingMessage.class);
|
|
|
|
|
|
|
+ ExcelUtils.export(response, "官网留言", wrapperList, OwLeavingMessage.class);
|
|
|
return AjaxResult.success("导出数据成功");
|
|
return AjaxResult.success("导出数据成功");
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
return AjaxResult.error("导出数据失败");
|
|
return AjaxResult.error("导出数据失败");
|
|
|
}
|
|
}
|
|
@@ -133,26 +138,25 @@ public class OwLeavingMessageController extends BaseController{
|
|
|
@Log(title = "官网留言", businessType = BusinessType.DELETE)
|
|
@Log(title = "官网留言", businessType = BusinessType.DELETE)
|
|
|
@PostMapping("/delete")
|
|
@PostMapping("/delete")
|
|
|
@ApiOperation(value = "删除官网留言", notes = "删除官网留言")
|
|
@ApiOperation(value = "删除官网留言", notes = "删除官网留言")
|
|
|
- public AjaxResult delete(@RequestBody List<String> ids)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public AjaxResult delete(@RequestBody List<String> ids) {
|
|
|
return toAjax(service.removeByIds(ids));
|
|
return toAjax(service.removeByIds(ids));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping("/deleteAll")
|
|
@DeleteMapping("/deleteAll")
|
|
|
@ApiOperation(value = "清除数据", notes = "清除数据")
|
|
@ApiOperation(value = "清除数据", notes = "清除数据")
|
|
|
- public AjaxResult deleteAll(){
|
|
|
|
|
|
|
+ public AjaxResult deleteAll() {
|
|
|
return service.deleteAll();
|
|
return service.deleteAll();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/getUploadTemplate")
|
|
@PostMapping("/getUploadTemplate")
|
|
|
@ApiOperation(value = "获取上传模板", notes = "获取上传模板")
|
|
@ApiOperation(value = "获取上传模板", notes = "获取上传模板")
|
|
|
public void getUploadTemplate(HttpServletResponse response) throws IOException {
|
|
public void getUploadTemplate(HttpServletResponse response) throws IOException {
|
|
|
- DowntemplateUtil.downloadTemplate(response,"官网留言模板");
|
|
|
|
|
|
|
+ DowntemplateUtil.downloadTemplate(response, "官网留言模板");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/generateVoucher")
|
|
@PostMapping("/generateVoucher")
|
|
|
- public void generateVoucher(HttpServletResponse response,String name,Long id) throws Exception {
|
|
|
|
|
- service.generateVoucher(response,name,id);
|
|
|
|
|
|
|
+ public void generateVoucher(HttpServletResponse response, String name, Long id) throws Exception {
|
|
|
|
|
+ service.generateVoucher(response, name, id);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|