|
@@ -0,0 +1,115 @@
|
|
|
+package com.zhongzheng.controller.user;
|
|
|
+
|
|
|
+import com.zhongzheng.common.annotation.Log;
|
|
|
+import com.zhongzheng.common.core.controller.BaseController;
|
|
|
+import com.zhongzheng.common.core.domain.AjaxResult;
|
|
|
+import com.zhongzheng.common.core.page.TableDataInfo;
|
|
|
+import com.zhongzheng.common.enums.BusinessType;
|
|
|
+import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.common.utils.poi.ExcelUtil;
|
|
|
+import com.zhongzheng.framework.web.service.WxTokenService;
|
|
|
+import com.zhongzheng.modules.user.bo.UserMockSubscribeAddBo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserMockSubscribeEditBo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserMockSubscribeQueryBo;
|
|
|
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
|
+import com.zhongzheng.modules.user.service.IUserMockSubscribeService;
|
|
|
+import com.zhongzheng.modules.user.vo.UserMockSubscribeVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用户预约模考Controller
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ * @date 2022-05-25
|
|
|
+ */
|
|
|
+@Api(value = "用户预约模考控制器", tags = {"用户预约模考管理"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/user/subscribe")
|
|
|
+public class UserMockSubscribeController extends BaseController {
|
|
|
+
|
|
|
+ private final IUserMockSubscribeService iUserMockSubscribeService;
|
|
|
+
|
|
|
+ private final WxTokenService wxTokenService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户预约模考列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询用户预约模考列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:subscribe:list')")
|
|
|
+ @GetMapping("/listSubscribe")
|
|
|
+ public TableDataInfo<UserMockSubscribeVo> listSubscribe(UserMockSubscribeQueryBo bo) {
|
|
|
+ startPage();
|
|
|
+ List<UserMockSubscribeVo> list = iUserMockSubscribeService.listSubscribe(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出用户预约模考列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出用户预约模考列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:subscribe:export')")
|
|
|
+ @Log(title = "用户预约模考", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult<UserMockSubscribeVo> export(UserMockSubscribeQueryBo bo) {
|
|
|
+ List<UserMockSubscribeVo> list = iUserMockSubscribeService.queryList(bo);
|
|
|
+ ExcelUtil<UserMockSubscribeVo> util = new ExcelUtil<UserMockSubscribeVo>(UserMockSubscribeVo.class);
|
|
|
+ return util.exportExcel(list, "用户预约模考");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户预约模考详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取用户预约模考详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:subscribe:query')")
|
|
|
+ @GetMapping("/{userId}")
|
|
|
+ public TableDataInfo<UserMockSubscribeVo> getInfo(@PathVariable("userId" ) Long userId) {
|
|
|
+ startPage();
|
|
|
+ List<UserMockSubscribeVo> list = iUserMockSubscribeService.getInfo(userId);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增用户预约模考
|
|
|
+ */
|
|
|
+ @ApiOperation("新增用户预约模考")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:subscribe:add')")
|
|
|
+ @Log(title = "用户预约模考", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Long> add(@RequestBody UserMockSubscribeAddBo bo) throws ParseException {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ return AjaxResult.success(iUserMockSubscribeService.insertByAddBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户预约模考
|
|
|
+ */
|
|
|
+ @ApiOperation("修改用户预约模考")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:subscribe:edit')")
|
|
|
+ @Log(title = "用户预约模考", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/edit")
|
|
|
+ public AjaxResult<Void> edit(@RequestBody UserMockSubscribeEditBo bo) {
|
|
|
+ return toAjax(iUserMockSubscribeService.updateByEditBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除用户预约模考
|
|
|
+ */
|
|
|
+ @ApiOperation("删除用户预约模考")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:subscribe:remove')")
|
|
|
+ @Log(title = "用户预约模考" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{subscribeIds}")
|
|
|
+ public AjaxResult<Void> remove(@PathVariable Long[] subscribeIds) {
|
|
|
+ return toAjax(iUserMockSubscribeService.deleteWithValidByIds(Arrays.asList(subscribeIds), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+}
|