|
@@ -0,0 +1,274 @@
|
|
|
|
|
+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.IExhibitorBiz;
|
|
|
|
|
+import net.mingsoft.tf.entity.ExhibitorEntity;
|
|
|
|
|
+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:08:02<br/>
|
|
|
|
|
+* 历史修订:<br/>
|
|
|
|
|
+*/
|
|
|
|
|
+@Tag(name = "后台-展商接口")
|
|
|
|
|
+@Controller("tfExhibitorAction")
|
|
|
|
|
+@RequestMapping("/${ms.manager.path}/tf/exhibitor")
|
|
|
|
|
+public class ExhibitorAction extends net.mingsoft.tf.action.BaseAction{
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 注入展商业务层
|
|
|
|
|
+ */
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IExhibitorBiz exhibitorBiz;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 返回主界面index
|
|
|
|
|
+ */
|
|
|
|
|
+ @Hidden
|
|
|
|
|
+ @GetMapping("/index")
|
|
|
|
|
+ public String index() {
|
|
|
|
|
+ return "/tf/exhibitor/index";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 返回编辑界面exhibitor的form
|
|
|
|
|
+ */
|
|
|
|
|
+ @Hidden
|
|
|
|
|
+ @GetMapping("/form")
|
|
|
|
|
+ public String form() {
|
|
|
|
|
+ return "/tf/exhibitor/form";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询展商列表
|
|
|
|
|
+ * @param exhibitor 展商实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "查询展商列表接口")
|
|
|
|
|
+ @Parameters({
|
|
|
|
|
+ @Parameter(name = "exhibitorName", description = "公司名称", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorBooth", description = "展位号", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorContact", description = "联系人", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorPhone", description = "联系电话", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorIntroduction", description = "公司简介", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorUser", description = "用户ID", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorActivities", description = "展会ID", in = ParameterIn.QUERY),
|
|
|
|
|
+ })
|
|
|
|
|
+ @RequestMapping(value ="/list",method = {RequestMethod.GET,RequestMethod.POST})
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @RequiresPermissions("tf:exhibitor:view")
|
|
|
|
|
+ public ResultData list(@ModelAttribute @Parameter(hidden = true) ExhibitorEntity exhibitor) {
|
|
|
|
|
+ BasicUtil.startPage();
|
|
|
|
|
+ List exhibitorList = null;
|
|
|
|
|
+ if ( exhibitor.getSqlWhere() != null){
|
|
|
|
|
+ exhibitorList = exhibitorBiz.query(exhibitor);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LambdaQueryWrapper<ExhibitorEntity> wrapper = new LambdaQueryWrapper<>(exhibitor).orderByDesc(ExhibitorEntity::getCreateDate);
|
|
|
|
|
+ exhibitorList = exhibitorBiz.list(wrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultData.build().success(new EUListBean(exhibitorList,(int)BasicUtil.endPage(exhibitorList).getTotal()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取展商
|
|
|
|
|
+ * @param exhibitor 展商实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "获取展商列表接口")
|
|
|
|
|
+ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY)
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @RequiresPermissions("tf:exhibitor:view")
|
|
|
|
|
+ public ResultData get(@ModelAttribute @Parameter(hidden = true) ExhibitorEntity exhibitor) {
|
|
|
|
|
+ if (StringUtils.isBlank(exhibitor.getId())) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.error",this.getResString("id")));
|
|
|
|
|
+ }
|
|
|
|
|
+ ExhibitorEntity _exhibitor = (ExhibitorEntity)exhibitorBiz.getById(exhibitor.getId());
|
|
|
|
|
+ return ResultData.build().success(_exhibitor);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 保存展商
|
|
|
|
|
+ * @param exhibitor 展商实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "保存展商列表接口")
|
|
|
|
|
+ @Parameters({
|
|
|
|
|
+ @Parameter(name = "exhibitorName", description = "公司名称", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorBooth", description = "展位号", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorContact", description = "联系人", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorPhone", description = "联系电话", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorLogo", description = "公司LOGO", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorIntroduction", description = "公司简介", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorUser", description = "用户ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorActivities", description = "展会ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ })
|
|
|
|
|
+ @PostMapping("/save")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @LogAnn(title = "保存展商", businessType = BusinessTypeEnum.INSERT)
|
|
|
|
|
+ @RequiresPermissions("tf:exhibitor:save")
|
|
|
|
|
+ public ResultData save(@ModelAttribute @Parameter(hidden = true) ExhibitorEntity exhibitor) {
|
|
|
|
|
+
|
|
|
|
|
+ //验证公司名称的值是否合法
|
|
|
|
|
+ if (StringUtils.isBlank(exhibitor.getExhibitorName())) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.empty", this.getResString("exhibitor.name")));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtil.checkLength(exhibitor.getExhibitorName()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.name"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ //验证展位号的值是否合法
|
|
|
|
|
+ if (StringUtils.isBlank(exhibitor.getExhibitorBooth())) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.empty", this.getResString("exhibitor.booth")));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtil.checkLength(exhibitor.getExhibitorBooth()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.booth"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorContact()) && !StringUtil.checkLength(exhibitor.getExhibitorContact()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.contact"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorPhone()) && !StringUtil.checkLength(exhibitor.getExhibitorPhone()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.phone"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorUser()) && !StringUtil.checkLength(exhibitor.getExhibitorUser()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.user"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorActivities()) && !StringUtil.checkLength(exhibitor.getExhibitorActivities()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.activities"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ exhibitorBiz.save(exhibitor);
|
|
|
|
|
+ return ResultData.build().success(exhibitor);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除展商
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param exhibitors 展商实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "批量删除展商列表接口")
|
|
|
|
|
+ @PostMapping("/delete")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @LogAnn(title = "删除展商", businessType = BusinessTypeEnum.DELETE)
|
|
|
|
|
+ @RequiresPermissions("tf:exhibitor:del")
|
|
|
|
|
+ public ResultData delete(@RequestBody List<ExhibitorEntity> exhibitors) {
|
|
|
|
|
+ List<String> ids = (List)exhibitors.stream().map((p) -> {return p.getId();}).collect(Collectors.toList());
|
|
|
|
|
+ return this.exhibitorBiz.removeByIds(ids) ? ResultData.build().success() : ResultData.build().error(this.getResString("err.error", new String[]{this.getResString("id")}));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新展商列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param exhibitor 展商实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "更新展商列表接口")
|
|
|
|
|
+ @Parameters({
|
|
|
|
|
+ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorName", description = "公司名称", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorBooth", description = "展位号", required = true, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorContact", description = "联系人", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorPhone", description = "联系电话", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorLogo", description = "公司LOGO", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorIntroduction", description = "公司简介", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorUser", description = "用户ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "exhibitorActivities", description = "展会ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ })
|
|
|
|
|
+ @PostMapping("/update")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @LogAnn(title = "更新展商", businessType = BusinessTypeEnum.UPDATE)
|
|
|
|
|
+ @RequiresPermissions("tf:exhibitor:update")
|
|
|
|
|
+ public ResultData update(@ModelAttribute @Parameter(hidden = true) ExhibitorEntity exhibitor) {
|
|
|
|
|
+ //先查询数据是否存在
|
|
|
|
|
+ ExhibitorEntity _exhibitor = (ExhibitorEntity)exhibitorBiz.getById(exhibitor.getId());
|
|
|
|
|
+ if(_exhibitor == null) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.not.exist",exhibitor.getId() ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //验证公司名称的值是否合法
|
|
|
|
|
+ if (StringUtils.isBlank(exhibitor.getExhibitorName())) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.empty", this.getResString("exhibitor.name")));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtil.checkLength(exhibitor.getExhibitorName()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.name"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ //验证展位号的值是否合法
|
|
|
|
|
+ if (StringUtils.isBlank(exhibitor.getExhibitorBooth())) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.empty", this.getResString("exhibitor.booth")));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtil.checkLength(exhibitor.getExhibitorBooth()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.booth"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorContact()) && !StringUtil.checkLength(exhibitor.getExhibitorContact()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.contact"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorPhone()) && !StringUtil.checkLength(exhibitor.getExhibitorPhone()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.phone"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorUser()) && !StringUtil.checkLength(exhibitor.getExhibitorUser()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.user"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(exhibitor.getExhibitorActivities()) && !StringUtil.checkLength(exhibitor.getExhibitorActivities()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("exhibitor.activities"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ exhibitorBiz.updateById(exhibitor);
|
|
|
|
|
+ return ResultData.build().success(exhibitor);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("verify")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResultData verify(String fieldName, String fieldValue, String id,String idName) {
|
|
|
|
|
+ boolean verify = false;
|
|
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
|
|
+ verify = super.validated("EXHIBITOR",fieldName,fieldValue);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ verify = super.validated("EXHIBITOR",fieldName,fieldValue,id,idName);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (verify) {
|
|
|
|
|
+ return ResultData.build().success(false);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return ResultData.build().success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|