| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- package net.mingsoft.tf.action;
- import java.util.List;
- import java.io.File;
- import java.util.ArrayList;
- import java.util.Map;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- import cn.hutool.core.util.ObjectUtil;
- import java.util.*;
- import net.mingsoft.base.entity.ResultData;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.bind.annotation.ModelAttribute;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import java.util.stream.Collectors;
- import org.springframework.web.bind.annotation.*;
- import net.mingsoft.tf.biz.IBoothBiz;
- import net.mingsoft.tf.entity.BoothEntity;
- import net.mingsoft.base.entity.BaseEntity;
- import net.mingsoft.basic.util.BasicUtil;
- import net.mingsoft.basic.util.StringUtil;
- import net.mingsoft.basic.bean.EUListBean;
- import net.mingsoft.basic.annotation.LogAnn;
- import net.mingsoft.basic.constant.e.BusinessTypeEnum;
- import org.apache.commons.lang3.StringUtils;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import io.swagger.v3.oas.annotations.Parameter;
- import io.swagger.v3.oas.annotations.Parameters;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.Hidden;
- import io.swagger.v3.oas.annotations.enums.ParameterIn;
- /**
- * 展位管理控制层
- * @author 阿白
- * 创建日期:2025年10月23日 下午6:41:34<br/>
- * 历史修订:<br/>
- */
- @Tag(name = "后台-展位接口")
- @Controller("tfBoothAction")
- @RequestMapping("/${ms.manager.path}/tf/booth")
- public class BoothAction extends net.mingsoft.tf.action.BaseAction{
- /**
- * 注入展位业务层
- */
- @Autowired
- private IBoothBiz boothBiz;
- /**
- * 返回主界面index
- */
- @Hidden
- @GetMapping("/index")
- public String index() {
- return "/tf/booth/index";
- }
- /**
- * 返回编辑界面booth的form
- */
- @Hidden
- @GetMapping("/form")
- public String form() {
- return "/tf/booth/form";
- }
- /**
- * 查询展位列表
- * @param booth 展位实体
- */
- @Operation(summary = "查询展位列表接口")
- @Parameters({
- @Parameter(name = "boothCode", description = "编码", in = ParameterIn.QUERY),
- @Parameter(name = "boothFloor", description = "楼层", in = ParameterIn.QUERY),
- @Parameter(name = "boothName", description = "名称", in = ParameterIn.QUERY),
- @Parameter(name = "boothStyle", description = "风格", in = ParameterIn.QUERY),
- @Parameter(name = "boothMaterials", description = "材料", in = ParameterIn.QUERY),
- @Parameter(name = "boothX", description = "坐标X", in = ParameterIn.QUERY),
- @Parameter(name = "boothY", description = "坐标Y", in = ParameterIn.QUERY),
- @Parameter(name = "boothWidth", description = "宽度", in = ParameterIn.QUERY),
- @Parameter(name = "boothHeight", description = "高度", in = ParameterIn.QUERY),
- })
- @RequestMapping(value ="/list",method = {RequestMethod.GET,RequestMethod.POST})
- @ResponseBody
- @RequiresPermissions("tf:booth:view")
- public ResultData list(@ModelAttribute @Parameter(hidden = true) BoothEntity booth) {
- BasicUtil.startPage();
- List boothList = null;
- if ( booth.getSqlWhere() != null){
- boothList = boothBiz.query(booth);
- } else {
- LambdaQueryWrapper<BoothEntity> wrapper = new LambdaQueryWrapper<>(booth).orderByDesc(BoothEntity::getCreateDate);
- boothList = boothBiz.list(wrapper);
- }
- return ResultData.build().success(new EUListBean(boothList,(int)BasicUtil.endPage(boothList).getTotal()));
- }
- /**
- * 获取展位
- * @param booth 展位实体
- */
- @Operation(summary = "获取展位列表接口")
- @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY)
- @GetMapping("/get")
- @ResponseBody
- @RequiresPermissions("tf:booth:view")
- public ResultData get(@ModelAttribute @Parameter(hidden = true) BoothEntity booth) {
- if (StringUtils.isBlank(booth.getId())) {
- return ResultData.build().error(getResString("err.error",this.getResString("id")));
- }
- BoothEntity _booth = (BoothEntity)boothBiz.getById(booth.getId());
- return ResultData.build().success(_booth);
- }
- /**
- * 保存展位
- * @param booth 展位实体
- */
- @Operation(summary = "保存展位列表接口")
- @Parameters({
- @Parameter(name = "boothCode", description = "编码", required = true, in = ParameterIn.QUERY),
- @Parameter(name = "boothFloor", description = "楼层", required = true, in = ParameterIn.QUERY),
- @Parameter(name = "boothName", description = "名称", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothStyle", description = "风格", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothMaterials", description = "材料", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothX", description = "坐标X", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothY", description = "坐标Y", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothWidth", description = "宽度", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothHeight", description = "高度", required = false, in = ParameterIn.QUERY),
- })
- @PostMapping("/save")
- @ResponseBody
- @LogAnn(title = "保存展位", businessType = BusinessTypeEnum.INSERT)
- @RequiresPermissions("tf:booth:save")
- public ResultData save(@ModelAttribute @Parameter(hidden = true) BoothEntity booth) {
- //验证编码的值是否重复
- if (super.validated("mdiy_form_booth","BOOTH_CODE",booth.getBoothCode())) {
- return ResultData.build().error(getResString("err.exist", this.getResString("booth.code")));
- }
- //验证编码的值是否合法
- if (StringUtils.isBlank(booth.getBoothCode())) {
- return ResultData.build().error(getResString("err.empty", this.getResString("booth.code")));
- }
- if (!StringUtil.checkLength(booth.getBoothCode()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.code"), "0", "255"));
- }
- //验证楼层的值是否合法
- if (StringUtils.isBlank(booth.getBoothFloor())) {
- return ResultData.build().error(getResString("err.empty", this.getResString("booth.floor")));
- }
- if (!StringUtil.checkLength(booth.getBoothFloor()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.floor"), "0", "255"));
- }
- if ( StringUtils.isNotBlank(booth.getBoothName()) && !StringUtil.checkLength(booth.getBoothName()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.name"), "0", "255"));
- }
- if ( StringUtils.isNotBlank(booth.getBoothStyle()) && !StringUtil.checkLength(booth.getBoothStyle()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.style"), "0", "255"));
- }
- if ( StringUtils.isNotBlank(booth.getBoothMaterials()) && !StringUtil.checkLength(booth.getBoothMaterials()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.materials"), "0", "255"));
- }
- if (!StringUtil.checkLength(booth.getBoothX()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.x"), "0", "11"));
- }
- if (!StringUtil.checkLength(booth.getBoothY()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.y"), "0", "11"));
- }
- if (!StringUtil.checkLength(booth.getBoothWidth()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.width"), "0", "11"));
- }
- if (!StringUtil.checkLength(booth.getBoothHeight()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.height"), "0", "11"));
- }
- boothBiz.save(booth);
- return ResultData.build().success(booth);
- }
- /**
- * 删除展位
- *
- * @param booths 展位实体
- */
- @Operation(summary = "批量删除展位列表接口")
- @PostMapping("/delete")
- @ResponseBody
- @LogAnn(title = "删除展位", businessType = BusinessTypeEnum.DELETE)
- @RequiresPermissions("tf:booth:del")
- public ResultData delete(@RequestBody List<BoothEntity> booths) {
- List<String> ids = (List)booths.stream().map((p) -> {return p.getId();}).collect(Collectors.toList());
- return this.boothBiz.removeByIds(ids) ? ResultData.build().success() : ResultData.build().error(this.getResString("err.error", new String[]{this.getResString("id")}));
- }
- /**
- * 更新展位列表
- *
- * @param booth 展位实体
- */
- @Operation(summary = "更新展位列表接口")
- @Parameters({
- @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY),
- @Parameter(name = "boothCode", description = "编码", required = true, in = ParameterIn.QUERY),
- @Parameter(name = "boothFloor", description = "楼层", required = true, in = ParameterIn.QUERY),
- @Parameter(name = "boothName", description = "名称", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothStyle", description = "风格", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothMaterials", description = "材料", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothX", description = "坐标X", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothY", description = "坐标Y", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothWidth", description = "宽度", required = false, in = ParameterIn.QUERY),
- @Parameter(name = "boothHeight", description = "高度", required = false, in = ParameterIn.QUERY),
- })
- @PostMapping("/update")
- @ResponseBody
- @LogAnn(title = "更新展位", businessType = BusinessTypeEnum.UPDATE)
- @RequiresPermissions("tf:booth:update")
- public ResultData update(@ModelAttribute @Parameter(hidden = true) BoothEntity booth) {
- //先查询数据是否存在
- BoothEntity _booth = (BoothEntity)boothBiz.getById(booth.getId());
- if(_booth == null) {
- return ResultData.build().error(getResString("err.not.exist",booth.getId() ));
- }
- //验证编码的值是否重复
- if (super.validated("mdiy_form_booth","BOOTH_CODE",booth.getBoothCode(), booth.getId(),"id")) {
- return ResultData.build().error(getResString("err.exist", this.getResString("booth.code")));
- }
- //验证编码的值是否合法
- if (StringUtils.isBlank(booth.getBoothCode())) {
- return ResultData.build().error(getResString("err.empty", this.getResString("booth.code")));
- }
- if (!StringUtil.checkLength(booth.getBoothCode()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.code"), "0", "255"));
- }
- //验证楼层的值是否合法
- if (StringUtils.isBlank(booth.getBoothFloor())) {
- return ResultData.build().error(getResString("err.empty", this.getResString("booth.floor")));
- }
- if (!StringUtil.checkLength(booth.getBoothFloor()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.floor"), "0", "255"));
- }
- if ( StringUtils.isNotBlank(booth.getBoothName()) && !StringUtil.checkLength(booth.getBoothName()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.name"), "0", "255"));
- }
- if ( StringUtils.isNotBlank(booth.getBoothStyle()) && !StringUtil.checkLength(booth.getBoothStyle()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.style"), "0", "255"));
- }
- if ( StringUtils.isNotBlank(booth.getBoothMaterials()) && !StringUtil.checkLength(booth.getBoothMaterials()+"", 0, 255)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.materials"), "0", "255"));
- }
- if (!StringUtil.checkLength(booth.getBoothX()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.x"), "0", "11"));
- }
- if (!StringUtil.checkLength(booth.getBoothY()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.y"), "0", "11"));
- }
- if (!StringUtil.checkLength(booth.getBoothWidth()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.width"), "0", "11"));
- }
- if (!StringUtil.checkLength(booth.getBoothHeight()+"", 0, 11)) {
- return ResultData.build().error(getResString("err.length", this.getResString("booth.height"), "0", "11"));
- }
- boothBiz.updateById(booth);
- return ResultData.build().success(booth);
- }
- @GetMapping("verify")
- @ResponseBody
- public ResultData verify(String fieldName, String fieldValue, String id,String idName) {
- boolean verify = false;
- if (StringUtils.isBlank(id)) {
- verify = super.validated("mdiy_form_booth",fieldName,fieldValue);
- } else {
- verify = super.validated("mdiy_form_booth",fieldName,fieldValue,id,idName);
- }
- if (verify) {
- return ResultData.build().success(false);
- }else {
- return ResultData.build().success(true);
- }
- }
- }
|