|
|
@@ -0,0 +1,279 @@
|
|
|
+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.IInvestmentPromotionBiz;
|
|
|
+import net.mingsoft.tf.entity.InvestmentPromotionEntity;
|
|
|
+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年12月13日 下午1:25:50<br/>
|
|
|
+* 历史修订:<br/>
|
|
|
+*/
|
|
|
+@Tag(name = "后台-招商管理接口")
|
|
|
+@Controller("tfInvestmentPromotionAction")
|
|
|
+@RequestMapping("/${ms.manager.path}/tf/investmentPromotion")
|
|
|
+public class InvestmentPromotionAction extends BaseAction{
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 注入招商管理业务层
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private IInvestmentPromotionBiz investmentPromotionBiz;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 返回主界面index
|
|
|
+ */
|
|
|
+ @Hidden
|
|
|
+ @GetMapping("/index")
|
|
|
+ public String index() {
|
|
|
+ return "/tf/investment-promotion/index";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 返回编辑界面investmentPromotion的form
|
|
|
+ */
|
|
|
+ @Hidden
|
|
|
+ @GetMapping("/form")
|
|
|
+ public String form() {
|
|
|
+ return "/tf/investment-promotion/form";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询招商管理列表
|
|
|
+ * @param investmentPromotion 招商管理实体
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询招商管理列表接口")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "investmentPromotionName", description = "招商名称", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionType", description = "房屋类型", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionRegion", description = "所在区域", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionArea", description = "面积(m²)", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionRent", description = "租金(元/月)", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionSpec", description = "规格", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionPerson", description = "招商负责人", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionTel", description = "联系电话", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionLocation", description = "具体位置", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionStatus", description = "发布状态", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionIntro", description = "招商简介", in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionDesc", description = "招商描述", in = ParameterIn.QUERY),
|
|
|
+ })
|
|
|
+ @RequestMapping(value ="/list",method = {RequestMethod.GET,RequestMethod.POST})
|
|
|
+ @ResponseBody
|
|
|
+ @RequiresPermissions("tf:investmentPromotion:view")
|
|
|
+ public ResultData list(@ModelAttribute @Parameter(hidden = true) InvestmentPromotionEntity investmentPromotion) {
|
|
|
+ BasicUtil.startPage();
|
|
|
+ List investmentPromotionList = null;
|
|
|
+ if ( investmentPromotion.getSqlWhere() != null){
|
|
|
+ investmentPromotionList = investmentPromotionBiz.query(investmentPromotion);
|
|
|
+ } else {
|
|
|
+ LambdaQueryWrapper<InvestmentPromotionEntity> wrapper = new LambdaQueryWrapper<>(investmentPromotion).orderByDesc(InvestmentPromotionEntity::getCreateDate);
|
|
|
+ investmentPromotionList = investmentPromotionBiz.list(wrapper);
|
|
|
+ }
|
|
|
+ return ResultData.build().success(new EUListBean(investmentPromotionList,(int)BasicUtil.endPage(investmentPromotionList).getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取招商管理
|
|
|
+ * @param investmentPromotion 招商管理实体
|
|
|
+ */
|
|
|
+ @Operation(summary = "获取招商管理列表接口")
|
|
|
+ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY)
|
|
|
+ @GetMapping("/get")
|
|
|
+ @ResponseBody
|
|
|
+ @RequiresPermissions("tf:investmentPromotion:view")
|
|
|
+ public ResultData get(@ModelAttribute @Parameter(hidden = true) InvestmentPromotionEntity investmentPromotion) {
|
|
|
+ if (StringUtils.isBlank(investmentPromotion.getId())) {
|
|
|
+ return ResultData.build().error(getResString("err.error",this.getResString("id")));
|
|
|
+ }
|
|
|
+ InvestmentPromotionEntity _investmentPromotion = (InvestmentPromotionEntity)investmentPromotionBiz.getById(investmentPromotion.getId());
|
|
|
+ return ResultData.build().success(_investmentPromotion);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存招商管理
|
|
|
+ * @param investmentPromotion 招商管理实体
|
|
|
+ */
|
|
|
+ @Operation(summary = "保存招商管理列表接口")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "investmentPromotionName", description = "招商名称", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionType", description = "房屋类型", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionRegion", description = "所在区域", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionArea", description = "面积(m²)", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionRent", description = "租金(元/月)", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionSpec", description = "规格", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionPerson", description = "招商负责人", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionTel", description = "联系电话", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionLocation", description = "具体位置", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionStatus", description = "发布状态", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionIntro", description = "招商简介", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionDesc", description = "招商描述", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionImg", description = "房屋图片", required = false, in = ParameterIn.QUERY),
|
|
|
+ })
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ResponseBody
|
|
|
+ @LogAnn(title = "保存招商管理", businessType = BusinessTypeEnum.INSERT)
|
|
|
+ @RequiresPermissions("tf:investmentPromotion:save")
|
|
|
+ public ResultData save(@ModelAttribute @Parameter(hidden = true) InvestmentPromotionEntity investmentPromotion) {
|
|
|
+
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionName()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionName()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.name"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionRegion()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionRegion()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.region"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionSpec()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionSpec()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.spec"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionPerson()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionPerson()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.person"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionTel()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionTel()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.tel"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionLocation()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionLocation()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.location"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionIntro()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionIntro()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.intro"), "0", "255"));
|
|
|
+ }
|
|
|
+ investmentPromotionBiz.save(investmentPromotion);
|
|
|
+ return ResultData.build().success(investmentPromotion);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除招商管理
|
|
|
+ *
|
|
|
+ * @param investmentPromotions 招商管理实体
|
|
|
+ */
|
|
|
+ @Operation(summary = "批量删除招商管理列表接口")
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @ResponseBody
|
|
|
+ @LogAnn(title = "删除招商管理", businessType = BusinessTypeEnum.DELETE)
|
|
|
+ @RequiresPermissions("tf:investmentPromotion:del")
|
|
|
+ public ResultData delete(@RequestBody List<InvestmentPromotionEntity> investmentPromotions) {
|
|
|
+ List<String> ids = (List)investmentPromotions.stream().map((p) -> {return p.getId();}).collect(Collectors.toList());
|
|
|
+ return this.investmentPromotionBiz.removeByIds(ids) ? ResultData.build().success() : ResultData.build().error(this.getResString("err.error", new String[]{this.getResString("id")}));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新招商管理列表
|
|
|
+ *
|
|
|
+ * @param investmentPromotion 招商管理实体
|
|
|
+ */
|
|
|
+ @Operation(summary = "更新招商管理列表接口")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionName", description = "招商名称", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionType", description = "房屋类型", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionRegion", description = "所在区域", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionArea", description = "面积(m²)", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionRent", description = "租金(元/月)", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionSpec", description = "规格", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionPerson", description = "招商负责人", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionTel", description = "联系电话", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionLocation", description = "具体位置", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionStatus", description = "发布状态", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionIntro", description = "招商简介", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionDesc", description = "招商描述", required = false, in = ParameterIn.QUERY),
|
|
|
+ @Parameter(name = "investmentPromotionImg", description = "房屋图片", required = false, in = ParameterIn.QUERY),
|
|
|
+ })
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ResponseBody
|
|
|
+ @LogAnn(title = "更新招商管理", businessType = BusinessTypeEnum.UPDATE)
|
|
|
+ @RequiresPermissions("tf:investmentPromotion:update")
|
|
|
+ public ResultData update(@ModelAttribute @Parameter(hidden = true) InvestmentPromotionEntity investmentPromotion) {
|
|
|
+ //先查询数据是否存在
|
|
|
+ InvestmentPromotionEntity _investmentPromotion = (InvestmentPromotionEntity)investmentPromotionBiz.getById(investmentPromotion.getId());
|
|
|
+ if(_investmentPromotion == null) {
|
|
|
+ return ResultData.build().error(getResString("err.not.exist",investmentPromotion.getId() ));
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionName()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionName()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.name"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionRegion()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionRegion()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.region"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionSpec()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionSpec()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.spec"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionPerson()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionPerson()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.person"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionTel()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionTel()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.tel"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionLocation()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionLocation()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.location"), "0", "255"));
|
|
|
+ }
|
|
|
+ if ( StringUtils.isNotBlank(investmentPromotion.getInvestmentPromotionIntro()) && !StringUtil.checkLength(investmentPromotion.getInvestmentPromotionIntro()+"", 0, 255)) {
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("investment.promotion.intro"), "0", "255"));
|
|
|
+ }
|
|
|
+ investmentPromotionBiz.updateById(investmentPromotion);
|
|
|
+ return ResultData.build().success(investmentPromotion);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("verify")
|
|
|
+ @ResponseBody
|
|
|
+ public ResultData verify(String fieldName, String fieldValue, String id,String idName) {
|
|
|
+ boolean verify = false;
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ verify = super.validated("INVESTMENT_PROMOTION",fieldName,fieldValue);
|
|
|
+ } else {
|
|
|
+ verify = super.validated("INVESTMENT_PROMOTION",fieldName,fieldValue,id,idName);
|
|
|
+ }
|
|
|
+ if (verify) {
|
|
|
+ return ResultData.build().success(false);
|
|
|
+ }else {
|
|
|
+ return ResultData.build().success(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|