Browse Source

场次优化

zhangxin 1 week ago
parent
commit
bccaec5842

+ 28 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/StadiumConcertsResponseVO.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.app.vo.stadium;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description="体育馆场次")
+public class StadiumConcertsResponseVO {
+
+    /**退款时间*/
+    @Schema(description = "退款时间")
+    private Integer  earlyRefundTime;
+    /**限购次数*/
+    @Schema(description = "限购次数")
+    private Integer  buyLimit;
+
+    /**当天场次已预约数*/
+    @Schema(description = "当天场所明细")
+    private List<StadiumConcertsVO> StadiumConcertsVOList;
+
+
+}

+ 101 - 58
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/controller/AppInstructorController.java

@@ -1,57 +1,59 @@
 package org.jeecg.modules.system.app.controller;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.query.QueryRuleEnum;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.system.app.entity.AppInstructor;
-import org.jeecg.modules.system.app.service.IAppInstructorService;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
-
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import me.zhyd.oauth.utils.UuidUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.PasswordUtil;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.base.service.BaseCommonService;
+import org.jeecg.modules.system.app.entity.AppInstructor;
+import org.jeecg.modules.system.app.service.IAppInstructorService;
+import org.jeecg.modules.system.app.vo.staff.StaffSaveVO;
+import org.jeecg.modules.system.entity.SysDepart;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysDepartService;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
- /**
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.Date;
+
+/**
  * @Description: 教练表
  * @Author: jeecg-boot
- * @Date:   2025-07-04
  * @Version: V1.0
  */
-@Tag(name="教练表")
+@Tag(name="员工信息")
 @RestController
-@RequestMapping("/org/jeecg/modules/app/appInstructor")
+@RequestMapping("/staff/staff")
 @Slf4j
 public class AppInstructorController extends JeecgController<AppInstructor, IAppInstructorService> {
 	@Autowired
 	private IAppInstructorService appInstructorService;
-	
+	 @Autowired
+	 private ISysUserService sysUserService;
+	@Autowired
+	private BaseCommonService baseCommonService;
+	@Autowired
+	private ISysDepartService sysDepartService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -62,7 +64,7 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
 	 * @return
 	 */
 	//@AutoLog(value = "教练表-分页列表查询")
-	@Operation(summary="教练表-分页列表查询")
+	@Operation(summary="员工信息-分页列表查询")
 	@GetMapping(value = "/list")
 	public Result<IPage<AppInstructor>> queryPageList(AppInstructor appInstructor,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@@ -79,31 +81,72 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
 	/**
 	 *   添加
 	 *
-	 * @param appInstructor
+	 * @param staffSaveVO
 	 * @return
 	 */
-	@AutoLog(value = "教练表-添加")
-	@Operation(summary="教练表-添加")
-	@RequiresPermissions("org.jeecg.modules.app:nm_instructor:add")
+	@AutoLog(value = "员工信息-添加")
+	@Operation(summary="员工信息-添加")
+	@RequiresPermissions("staff:add")
 	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody AppInstructor appInstructor) {
+	@Transactional
+	public Result<String> add(@RequestBody StaffSaveVO staffSaveVO) {
+		SysUser user = new SysUser();
+		AppInstructor appInstructor = new AppInstructor();
+		if (StringUtils.isEmpty(staffSaveVO.getSelectedroles())){
+			return Result.error("角色权限为空");
+		}
+		if (StringUtils.isEmpty(staffSaveVO.getSelecteddeparts())){
+			return Result.error("所属部门为空");
+		}
+		if (staffSaveVO.getSelectedroles().indexOf("instructor")==0){
+			if (staffSaveVO.getSelecteddeparts().contains(",")){
+				return Result.error("该角色涉及教练,不允许多部门");
+			}
+		}
+		SysDepart departById = sysDepartService.getDepartById(staffSaveVO.getSelecteddeparts());
+		try {
+			BeanUtils.copyProperties(staffSaveVO,user);
+			user.setId(UuidUtils.getUUID());
+			user.setCreateTime(new Date());//设置创建时间
+			String salt = oConvertUtils.randomGen(8);
+			user.setSalt(salt);
+			String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), salt);
+			user.setPassword(passwordEncode);
+			user.setStatus(1);
+			user.setDelFlag(CommonConstant.DEL_FLAG_0);
+			user.setUserIdentity(CommonConstant.USER_IDENTITY_1);
+			//用户表字段org_code不能在这里设置他的值
+			user.setOrgCode(departById.getOrgCode());
+			// 保存用户走一个service 保证事务
+			sysUserService.saveUser(user, staffSaveVO.getSelectedroles(), staffSaveVO.getSelecteddeparts(), null);
+			baseCommonService.addLog("添加用户,username: " +user.getUsername() ,CommonConstant.LOG_TYPE_2, 2);
+		} catch (Exception e) {
+			log.error(e.getMessage(), e);
+			return Result.error("添加失败!");
+		}
+		BeanUtils.copyProperties(staffSaveVO,appInstructor);
+		appInstructor.setUserId(user.getId());
+		appInstructor.setDelFlag(CommonConstant.DEL_FLAG_0);
 		appInstructorService.save(appInstructor);
-
 		return Result.OK("添加成功!");
 	}
 	
 	/**
 	 *  编辑
 	 *
-	 * @param appInstructor
+	 * @param staffSaveVO
 	 * @return
 	 */
-	@AutoLog(value = "教练表-编辑")
-	@Operation(summary="教练表-编辑")
-	@RequiresPermissions("org.jeecg.modules.app:nm_instructor:edit")
+	@AutoLog(value = "员工信息-编辑")
+	@Operation(summary="员工信息-编辑")
+	@RequiresPermissions("staff:edit")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody AppInstructor appInstructor) {
-		appInstructorService.updateById(appInstructor);
+	public Result<String> edit(@RequestBody StaffSaveVO staffSaveVO) {
+		if (staffSaveVO==null||StringUtils.isEmpty(staffSaveVO.getId())){
+			return Result.error("编辑失败!请选择需要编辑的员工信息。");
+		}
+//		sysUserService.findByUserIdStaff(staffSaveVO.getId());
+//		appInstructorService.updateById(appInstructor);
 		return Result.OK("编辑成功!");
 	}
 	
@@ -113,9 +156,9 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "教练表-通过id删除")
-	@Operation(summary="教练表-通过id删除")
-	@RequiresPermissions("org.jeecg.modules.app:nm_instructor:delete")
+	@AutoLog(value = "员工信息-通过id删除")
+	@Operation(summary="员工信息-通过id删除")
+	@RequiresPermissions("staff:delete")
 	@DeleteMapping(value = "/delete")
 	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
 		appInstructorService.removeById(id);
@@ -128,9 +171,9 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
 	 * @param ids
 	 * @return
 	 */
-	@AutoLog(value = "教练表-批量删除")
-	@Operation(summary="教练表-批量删除")
-	@RequiresPermissions("org.jeecg.modules.app:nm_instructor:deleteBatch")
+	@AutoLog(value = "员工信息-批量删除")
+	@Operation(summary="员工信息-批量删除")
+	@RequiresPermissions("staff:deleteBatch")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
 		this.appInstructorService.removeByIds(Arrays.asList(ids.split(",")));
@@ -144,7 +187,7 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
 	 * @return
 	 */
 	//@AutoLog(value = "教练表-通过id查询")
-	@Operation(summary="教练表-通过id查询")
+	@Operation(summary="员工信息-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<AppInstructor> queryById(@RequestParam(name="id",required=true) String id) {
 		AppInstructor appInstructor = appInstructorService.getById(id);
@@ -160,10 +203,10 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
     * @param request
     * @param appInstructor
     */
-    @RequiresPermissions("org.jeecg.modules.app:nm_instructor:exportXls")
+    @RequiresPermissions("staff:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, AppInstructor appInstructor) {
-        return super.exportXls(request, appInstructor, AppInstructor.class, "教练表");
+        return super.exportXls(request, appInstructor, AppInstructor.class, "员工表");
     }
 
     /**
@@ -173,7 +216,7 @@ public class AppInstructorController extends JeecgController<AppInstructor, IApp
     * @param response
     * @return
     */
-    @RequiresPermissions("org.jeecg.modules.app:nm_instructor:importExcel")
+    @RequiresPermissions("staff:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         return super.importExcel(request, response, AppInstructor.class);

+ 74 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/vo/staff/StaffSaveVO.java

@@ -0,0 +1,74 @@
+package org.jeecg.modules.system.app.vo.staff;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @author DM
+ * @date 2025/7/7 17:37
+ * @description
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
+@Schema(description="员工请求参数")
+public class StaffSaveVO {
+
+    @Schema(description = "id")
+    private String id;
+    /**名称*/
+    @Schema(description = "登录账号")
+    private String username;
+    /**地址*/
+    @Schema(description = "用户名称(真实姓名)")
+    private String realname;
+    /**1-正常,2-冻结*/
+    @Schema(description = "用户状态1-正常,2-冻结")
+    private Integer status;
+    /**密码*/
+    @Schema(description = "密码")
+    private String password;
+
+
+    @Schema(description = "所属角色")
+    private String  selectedroles;
+
+    @Schema(description = "所属部门")
+    private String  selecteddeparts;
+    /**部门编号*/
+    @Excel(name = "部门编号", width = 15)
+    @Schema(description = "部门编号")
+    private String orgCode;
+    /**培训项目*/
+    @Excel(name = "培训项目", width = 15)
+    @Schema(description = "培训项目,使用,分割")
+    private String trainingPrograms;
+    /**教学理念*/
+    @Excel(name = "教学理念", width = 15)
+    @Schema(description = "教学理念")
+    private String teachingPhilosophy;
+    /**擅长说明*/
+    @Excel(name = "擅长说明", width = 15)
+    @Schema(description = "擅长说明")
+    private String excelMsg;
+    /**无犯罪证明*/
+    @Excel(name = "无犯罪证明", width = 15)
+    @Schema(description = "无犯罪证明")
+    private String certificateInnocence;
+    /**健康证*/
+    @Excel(name = "健康证", width = 15)
+    @Schema(description = "健康证")
+    private String healthy;
+    /**荣誉证书多个逗号分隔*/
+    @Excel(name = "荣誉证书多个逗号分隔", width = 15)
+    @Schema(description = "荣誉证书多个逗号分隔")
+    private String honor;
+
+}