活动controller
This commit is contained in:
parent
683bda190d
commit
d8ef995541
|
|
@ -0,0 +1,167 @@
|
||||||
|
package com.dkl.large.controller;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.koal.kms.sdk.ed.KmsSdkException;
|
||||||
|
import com.dkl.common.annotation.DataScope;
|
||||||
|
import com.dkl.common.core.domain.entity.SysUser;
|
||||||
|
import com.dkl.large.domain.DklActivity;
|
||||||
|
import com.dkl.large.service.IDklActivityService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.dkl.common.annotation.Log;
|
||||||
|
import com.dkl.common.core.controller.BaseController;
|
||||||
|
import com.dkl.common.core.domain.AjaxResult;
|
||||||
|
import com.dkl.common.enums.BusinessType;
|
||||||
|
import com.dkl.common.utils.poi.ExcelUtil;
|
||||||
|
import com.dkl.common.core.page.TableDataInfo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大客流活动Controller
|
||||||
|
*
|
||||||
|
* @author Dkl
|
||||||
|
* @date 2025-05-27
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/large/activity")
|
||||||
|
public class DklActivityController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IDklActivityService dklActivityService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大客流活动列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@DataScope(deptAlias = "d")
|
||||||
|
@PreAuthorize("@ss.hasPermi('large:activity:list')")
|
||||||
|
public TableDataInfo list(DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
startPage();
|
||||||
|
List<DklActivity> list = dklActivityService.selectDklActivityList(dklActivity);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listMessage")
|
||||||
|
@DataScope(deptAlias = "d")
|
||||||
|
@PreAuthorize("@ss.hasPermi('large:activity:list')")
|
||||||
|
public AjaxResult listMessage(DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
|
||||||
|
String message = dklActivityService.selectDklActivityListMessage(dklActivity);
|
||||||
|
return success(message);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询大客流活动
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
@DataScope(deptAlias = "d")
|
||||||
|
@PreAuthorize("@ss.hasPermi('large:activity:list')")
|
||||||
|
public TableDataInfo listAll(DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
dklActivity.setDelFlag("0");
|
||||||
|
List<DklActivity> list = dklActivityService.selectDklActivityList(dklActivity);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询大客流活动
|
||||||
|
*/
|
||||||
|
@GetMapping("/listOutAll")
|
||||||
|
public TableDataInfo listOutAll(DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
startPage();
|
||||||
|
List<DklActivity> list = dklActivityService.selectDklActivityList(dklActivity);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 导出大客流活动列表
|
||||||
|
*/
|
||||||
|
@Log(title = "大客流活动", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
dklActivity.setDelFlag("0");
|
||||||
|
List<DklActivity> list = dklActivityService.selectDklActivityList(dklActivity);
|
||||||
|
ExcelUtil<DklActivity> util = new ExcelUtil<DklActivity>(DklActivity.class);
|
||||||
|
util.exportExcel(response, list, "大客流活动数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取大客流活动详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") int id) throws KmsSdkException {
|
||||||
|
return success(dklActivityService.selectDklActivityById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大客流活动
|
||||||
|
*/
|
||||||
|
@Log(title = "大客流活动", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
if(!dklActivityService.checkActivityNameUnique(dklActivity)){
|
||||||
|
return error("新增大客流活动'" + dklActivity.getActivityName() + "'失败,名称已存在");
|
||||||
|
}
|
||||||
|
//添加系统信息
|
||||||
|
dklActivity.setDelFlag("0");
|
||||||
|
dklActivity.setCreateTime(new Date());
|
||||||
|
dklActivity.setCreateBy(getUsername());
|
||||||
|
dklActivity.setDeptId(getDeptId());
|
||||||
|
dklActivity.setUpdateTime(new Date());
|
||||||
|
dklActivity.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dklActivityService.insertDklActivity(dklActivity));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大客流活动
|
||||||
|
*/
|
||||||
|
@Log(title = "大客流活动", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit( @Validated @RequestBody DklActivity dklActivity) throws KmsSdkException {
|
||||||
|
if (!dklActivityService.checkActivityNameUnique(dklActivity))
|
||||||
|
{
|
||||||
|
return error("修改大客流活动'" + dklActivity.getActivityName() + "'失败,名称已存在");
|
||||||
|
}
|
||||||
|
//添加系统信息
|
||||||
|
dklActivity.setUpdateTime(new Date());
|
||||||
|
dklActivity.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dklActivityService.updateDklActivity(dklActivity));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除大客流活动
|
||||||
|
*/
|
||||||
|
@Log(title = "大客流活动", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable int[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(dklActivityService.deleteDklActivityByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/importTemplate")
|
||||||
|
public void importTemplate(HttpServletResponse response)
|
||||||
|
{
|
||||||
|
ExcelUtil<DklActivity> util = new ExcelUtil<DklActivity>(DklActivity.class);
|
||||||
|
util.importTemplateExcel(response, "活动信息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/importData")
|
||||||
|
public AjaxResult importData(MultipartFile file) throws Exception
|
||||||
|
{
|
||||||
|
ExcelUtil<DklActivity> util = new ExcelUtil<DklActivity>(DklActivity.class);
|
||||||
|
List<DklActivity> activityList = util.importExcel(file.getInputStream());
|
||||||
|
String operName = getUsername();
|
||||||
|
String message = dklActivityService.importDate(activityList, operName);
|
||||||
|
return success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue