|
@@ -0,0 +1,262 @@
|
|
|
|
|
+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.IBrowseRecordsBiz;
|
|
|
|
|
+import net.mingsoft.tf.entity.BrowseRecordsEntity;
|
|
|
|
|
+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月31日 下午6:00:57<br/>
|
|
|
|
|
+* 历史修订:<br/>
|
|
|
|
|
+*/
|
|
|
|
|
+@Tag(name = "后台-浏览记录接口")
|
|
|
|
|
+@Controller("tfBrowseRecordsAction")
|
|
|
|
|
+@RequestMapping("/${ms.manager.path}/tf/browseRecords")
|
|
|
|
|
+public class BrowseRecordsAction extends net.mingsoft.tf.action.BaseAction{
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 注入浏览记录业务层
|
|
|
|
|
+ */
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IBrowseRecordsBiz browseRecordsBiz;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 返回主界面index
|
|
|
|
|
+ */
|
|
|
|
|
+ @Hidden
|
|
|
|
|
+ @GetMapping("/index")
|
|
|
|
|
+ public String index() {
|
|
|
|
|
+ return "/tf/browse-records/index";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 返回编辑界面browseRecords的form
|
|
|
|
|
+ */
|
|
|
|
|
+ @Hidden
|
|
|
|
|
+ @GetMapping("/form")
|
|
|
|
|
+ public String form() {
|
|
|
|
|
+ return "/tf/browse-records/form";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询浏览记录列表
|
|
|
|
|
+ * @param browseRecords 浏览记录实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "查询浏览记录列表接口")
|
|
|
|
|
+ @Parameters({
|
|
|
|
|
+ @Parameter(name = "recordsUser", description = "用户", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsEnterprise", description = "企业", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsEnterpriseId", description = "企业ID", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsProducts", description = "产品", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsProductsId", description = "产品ID", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsDesign", description = "设计谷", in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsDesignId", description = "设计谷ID", in = ParameterIn.QUERY),
|
|
|
|
|
+ })
|
|
|
|
|
+ @RequestMapping(value ="/list",method = {RequestMethod.GET,RequestMethod.POST})
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @RequiresPermissions("tf:browseRecords:view")
|
|
|
|
|
+ public ResultData list(@ModelAttribute @Parameter(hidden = true) BrowseRecordsEntity browseRecords) {
|
|
|
|
|
+ BasicUtil.startPage();
|
|
|
|
|
+ List browseRecordsList = null;
|
|
|
|
|
+ if ( browseRecords.getSqlWhere() != null){
|
|
|
|
|
+ browseRecordsList = browseRecordsBiz.query(browseRecords);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LambdaQueryWrapper<BrowseRecordsEntity> wrapper = new LambdaQueryWrapper<>(browseRecords).orderByDesc(BrowseRecordsEntity::getCreateDate);
|
|
|
|
|
+ browseRecordsList = browseRecordsBiz.list(wrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultData.build().success(new EUListBean(browseRecordsList,(int)BasicUtil.endPage(browseRecordsList).getTotal()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取浏览记录
|
|
|
|
|
+ * @param browseRecords 浏览记录实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "获取浏览记录列表接口")
|
|
|
|
|
+ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY)
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @RequiresPermissions("tf:browseRecords:view")
|
|
|
|
|
+ public ResultData get(@ModelAttribute @Parameter(hidden = true) BrowseRecordsEntity browseRecords) {
|
|
|
|
|
+ if (StringUtils.isBlank(browseRecords.getId())) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.error",this.getResString("id")));
|
|
|
|
|
+ }
|
|
|
|
|
+ BrowseRecordsEntity _browseRecords = (BrowseRecordsEntity)browseRecordsBiz.getById(browseRecords.getId());
|
|
|
|
|
+ return ResultData.build().success(_browseRecords);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 保存浏览记录
|
|
|
|
|
+ * @param browseRecords 浏览记录实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "保存浏览记录列表接口")
|
|
|
|
|
+ @Parameters({
|
|
|
|
|
+ @Parameter(name = "recordsUser", description = "用户", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsEnterprise", description = "企业", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsEnterpriseId", description = "企业ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsProducts", description = "产品", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsProductsId", description = "产品ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsDesign", description = "设计谷", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsDesignId", description = "设计谷ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ })
|
|
|
|
|
+ @PostMapping("/save")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @LogAnn(title = "保存浏览记录", businessType = BusinessTypeEnum.INSERT)
|
|
|
|
|
+ @RequiresPermissions("tf:browseRecords:save")
|
|
|
|
|
+ public ResultData save(@ModelAttribute @Parameter(hidden = true) BrowseRecordsEntity browseRecords) {
|
|
|
|
|
+
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsUser()) && !StringUtil.checkLength(browseRecords.getRecordsUser()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.user"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsEnterprise()) && !StringUtil.checkLength(browseRecords.getRecordsEnterprise()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.enterprise"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsEnterpriseId()) && !StringUtil.checkLength(browseRecords.getRecordsEnterpriseId()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.enterprise.id"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsProducts()) && !StringUtil.checkLength(browseRecords.getRecordsProducts()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.products"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsProductsId()) && !StringUtil.checkLength(browseRecords.getRecordsProductsId()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.products.id"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsDesign()) && !StringUtil.checkLength(browseRecords.getRecordsDesign()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.design"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsDesignId()) && !StringUtil.checkLength(browseRecords.getRecordsDesignId()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.design.id"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ browseRecordsBiz.save(browseRecords);
|
|
|
|
|
+ return ResultData.build().success(browseRecords);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除浏览记录
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param browseRecordss 浏览记录实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "批量删除浏览记录列表接口")
|
|
|
|
|
+ @PostMapping("/delete")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @LogAnn(title = "删除浏览记录", businessType = BusinessTypeEnum.DELETE)
|
|
|
|
|
+ @RequiresPermissions("tf:browseRecords:del")
|
|
|
|
|
+ public ResultData delete(@RequestBody List<BrowseRecordsEntity> browseRecordss) {
|
|
|
|
|
+ List<String> ids = (List)browseRecordss.stream().map((p) -> {return p.getId();}).collect(Collectors.toList());
|
|
|
|
|
+ return this.browseRecordsBiz.removeByIds(ids) ? ResultData.build().success() : ResultData.build().error(this.getResString("err.error", new String[]{this.getResString("id")}));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新浏览记录列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param browseRecords 浏览记录实体
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "更新浏览记录列表接口")
|
|
|
|
|
+ @Parameters({
|
|
|
|
|
+ @Parameter(name = "id", description = "主键ID", required =true,in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsUser", description = "用户", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsEnterprise", description = "企业", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsEnterpriseId", description = "企业ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsProducts", description = "产品", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsProductsId", description = "产品ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsDesign", description = "设计谷", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ @Parameter(name = "recordsDesignId", description = "设计谷ID", required = false, in = ParameterIn.QUERY),
|
|
|
|
|
+ })
|
|
|
|
|
+ @PostMapping("/update")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @LogAnn(title = "更新浏览记录", businessType = BusinessTypeEnum.UPDATE)
|
|
|
|
|
+ @RequiresPermissions("tf:browseRecords:update")
|
|
|
|
|
+ public ResultData update(@ModelAttribute @Parameter(hidden = true) BrowseRecordsEntity browseRecords) {
|
|
|
|
|
+ //先查询数据是否存在
|
|
|
|
|
+ BrowseRecordsEntity _browseRecords = (BrowseRecordsEntity)browseRecordsBiz.getById(browseRecords.getId());
|
|
|
|
|
+ if(_browseRecords == null) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.not.exist",browseRecords.getId() ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsUser()) && !StringUtil.checkLength(browseRecords.getRecordsUser()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.user"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsEnterprise()) && !StringUtil.checkLength(browseRecords.getRecordsEnterprise()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.enterprise"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsEnterpriseId()) && !StringUtil.checkLength(browseRecords.getRecordsEnterpriseId()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.enterprise.id"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsProducts()) && !StringUtil.checkLength(browseRecords.getRecordsProducts()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.products"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsProductsId()) && !StringUtil.checkLength(browseRecords.getRecordsProductsId()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.products.id"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsDesign()) && !StringUtil.checkLength(browseRecords.getRecordsDesign()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.design"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( StringUtils.isNotBlank(browseRecords.getRecordsDesignId()) && !StringUtil.checkLength(browseRecords.getRecordsDesignId()+"", 0, 255)) {
|
|
|
|
|
+ return ResultData.build().error(getResString("err.length", this.getResString("records.design.id"), "0", "255"));
|
|
|
|
|
+ }
|
|
|
|
|
+ browseRecordsBiz.updateById(browseRecords);
|
|
|
|
|
+ return ResultData.build().success(browseRecords);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("verify")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResultData verify(String fieldName, String fieldValue, String id,String idName) {
|
|
|
|
|
+ boolean verify = false;
|
|
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
|
|
+ verify = super.validated("BROWSE_RECORDS",fieldName,fieldValue);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ verify = super.validated("BROWSE_RECORDS",fieldName,fieldValue,id,idName);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (verify) {
|
|
|
|
|
+ return ResultData.build().success(false);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ return ResultData.build().success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|