Ver código fonte

发送用户报告

guomengjiao 2 meses atrás
pai
commit
60fc6e672e

+ 5 - 0
common/src/main/java/com/jeesite/common/constant/Constants.java

@@ -192,6 +192,11 @@ public interface Constants {
         String BRIEFING_INFO_PPT = "briefing_info_ppt";     //ppt
     }
 
+    // 发送网站用户报告
+    interface websiteUserReport{
+        String WEBSITE_USER_REPORT_FILE = "website_user_report_file";
+    }
+
     interface enableType{
         String YES = "1";
         String NO = "0";

+ 34 - 0
modules/bjflapi/src/main/java/com/jeesite/modules/bjflapi/report/WebsiteUserReportControllerApi.java

@@ -0,0 +1,34 @@
+package com.jeesite.modules.bjflapi.report;
+
+import com.jeesite.common.entity.Page;
+import com.jeesite.modules.bjflapi.AbstractController;
+import com.jeesite.modules.report.entity.WebsiteUserReport;
+import com.jeesite.modules.report.service.WebsiteUserReportService;
+import com.jeesite.modules.sys.annotation.WebsiteAuth;
+import com.jeesite.modules.sys.utils.R;
+import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping(value = "${adminPath}/api/report/websiteUserReport")
+@Api(value = "WebsiteUserReportControllerApi", tags = "发送网站用户报告接口")
+public class WebsiteUserReportControllerApi extends AbstractController {
+    @Resource
+    private WebsiteUserReportService websiteUserReportService;
+
+    /**
+     * 我的订单
+     */
+    @WebsiteAuth
+    @PostMapping(value = "reportList")
+    public R<Page<WebsiteUserReport>> reportList(WebsiteUserReport websiteUserReport) {
+        String userId = getUserIdByRequest();
+        websiteUserReport.setWebsiteUserId(userId);
+        return R.ok(websiteUserReportService.findPage(websiteUserReport));
+    }
+
+}

+ 15 - 0
modules/report/src/main/java/com/jeesite/modules/report/dao/WebsiteUserReportDao.java

@@ -0,0 +1,15 @@
+package com.jeesite.modules.report.dao;
+
+import com.jeesite.common.dao.CrudDao;
+import com.jeesite.common.mybatis.annotation.MyBatisDao;
+import com.jeesite.modules.report.entity.WebsiteUserReport;
+
+/**
+ * 发送网站用户报告DAO接口
+ * @author gmj
+ * @version 2026-01-08
+ */
+@MyBatisDao(dataSourceName="ds02")
+public interface WebsiteUserReportDao extends CrudDao<WebsiteUserReport> {
+	
+}

+ 84 - 0
modules/report/src/main/java/com/jeesite/modules/report/entity/WebsiteUserReport.java

@@ -0,0 +1,84 @@
+package com.jeesite.modules.report.entity;
+
+import com.jeesite.common.entity.DataEntity;
+import com.jeesite.common.mybatis.annotation.Column;
+import com.jeesite.common.mybatis.annotation.Table;
+import com.jeesite.common.mybatis.mapper.query.QueryType;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+
+/**
+ * 发送网站用户报告Entity
+ * @author gmj
+ * @version 2026-01-08
+ */
+@Table(name="website_user_report", alias="a", label="发送网站用户报告信息", columns={
+		@Column(name="id", attrName="id", label="id", isPK=true),
+		@Column(includeEntity=DataEntity.class),
+		@Column(name="website_user_id", attrName="websiteUserId", label="网站用户id"),
+		@Column(name="report_name", attrName="reportName", label="报告名称", queryType=QueryType.LIKE),
+	}, orderBy="a.update_date DESC"
+)
+public class WebsiteUserReport extends DataEntity<WebsiteUserReport> {
+	
+	private static final long serialVersionUID = 1L;
+	private String websiteUserId;		// 网站用户id
+	private String reportName;		// 报告名称
+
+	private String filePath;
+	private String fileName;
+	private Long fileSize;
+
+	public WebsiteUserReport() {
+		this(null);
+	}
+	
+	public WebsiteUserReport(String id){
+		super(id);
+	}
+	
+	@NotBlank(message="网站用户id不能为空")
+	@Size(min=0, max=64, message="网站用户id长度不能超过 64 个字符")
+	public String getWebsiteUserId() {
+		return websiteUserId;
+	}
+
+	public void setWebsiteUserId(String websiteUserId) {
+		this.websiteUserId = websiteUserId;
+	}
+	
+	@NotBlank(message="报告名称不能为空")
+	@Size(min=0, max=255, message="报告名称长度不能超过 255 个字符")
+	public String getReportName() {
+		return reportName;
+	}
+
+	public void setReportName(String reportName) {
+		this.reportName = reportName;
+	}
+
+	public String getFilePath() {
+		return filePath;
+	}
+
+	public void setFilePath(String filePath) {
+		this.filePath = filePath;
+	}
+
+	public String getFileName() {
+		return fileName;
+	}
+
+	public void setFileName(String fileName) {
+		this.fileName = fileName;
+	}
+
+	public Long getFileSize() {
+		return fileSize;
+	}
+
+	public void setFileSize(Long fileSize) {
+		this.fileSize = fileSize;
+	}
+}

+ 112 - 0
modules/report/src/main/java/com/jeesite/modules/report/service/WebsiteUserReportService.java

@@ -0,0 +1,112 @@
+package com.jeesite.modules.report.service;
+
+import com.jeesite.common.constant.Constants;
+import com.jeesite.common.entity.Page;
+import com.jeesite.common.service.CrudService;
+import com.jeesite.modules.file.entity.FileEntity;
+import com.jeesite.modules.file.entity.FileUpload;
+import com.jeesite.modules.file.utils.FileUploadUtils;
+import com.jeesite.modules.report.dao.WebsiteUserReportDao;
+import com.jeesite.modules.report.entity.WebsiteUserReport;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 发送网站用户报告Service
+ * @author gmj
+ * @version 2026-01-08
+ */
+@Service
+public class WebsiteUserReportService extends CrudService<WebsiteUserReportDao, WebsiteUserReport> {
+	
+	/**
+	 * 获取单条数据
+	 * @param websiteUserReport
+	 * @return
+	 */
+	@Override
+	public WebsiteUserReport get(WebsiteUserReport websiteUserReport) {
+		return super.get(websiteUserReport);
+	}
+	
+	/**
+	 * 查询分页数据
+	 * @param websiteUserReport 查询条件
+	 * @param websiteUserReport.page 分页对象
+	 * @return
+	 */
+	@Override
+	public Page<WebsiteUserReport> findPage(WebsiteUserReport websiteUserReport) {
+		int pageSize = websiteUserReport.getPageSize();
+		Page<WebsiteUserReport> page = super.findPage(websiteUserReport);
+		page.setList(page.getList().stream()
+				.map(w -> convertFile(w, w.getId(), Constants.websiteUserReport.WEBSITE_USER_REPORT_FILE))
+				.collect(Collectors.toList()));
+		long total = super.findCount(websiteUserReport);
+		long count = total / pageSize;
+		if(total % pageSize > 0){
+			count = count +1;
+		}
+		page.setCount(count);
+		return page;
+	}
+
+	public WebsiteUserReport convertFile(WebsiteUserReport websiteUserReport, String bizKey, String bizType) {
+		List<FileUpload> list = FileUploadUtils.findFileUpload(bizKey, bizType);
+		if (CollectionUtils.isNotEmpty(list)) {
+			FileEntity fileEntity = list.get(0).getFileEntity();
+			if (fileEntity != null) {
+				websiteUserReport.setFileName(fileEntity.getFileId() + '.' + fileEntity.getFileExtension());
+				websiteUserReport.setFilePath(fileEntity.getFilePath());
+				websiteUserReport.setFileSize(fileEntity.getFileSize());
+			}
+		}
+		return websiteUserReport;
+	}
+	
+	/**
+	 * 查询列表数据
+	 * @param websiteUserReport
+	 * @return
+	 */
+	@Override
+	public List<WebsiteUserReport> findList(WebsiteUserReport websiteUserReport) {
+		return super.findList(websiteUserReport);
+	}
+	
+	/**
+	 * 保存数据(插入或更新)
+	 * @param websiteUserReport
+	 */
+	@Override
+	@Transactional
+	public void save(WebsiteUserReport websiteUserReport) {
+		super.save(websiteUserReport);
+		FileUploadUtils.saveFileUpload(websiteUserReport,websiteUserReport.getId(), Constants.websiteUserReport.WEBSITE_USER_REPORT_FILE);
+	}
+	
+	/**
+	 * 更新状态
+	 * @param websiteUserReport
+	 */
+	@Override
+	@Transactional
+	public void updateStatus(WebsiteUserReport websiteUserReport) {
+		super.updateStatus(websiteUserReport);
+	}
+	
+	/**
+	 * 删除数据
+	 * @param websiteUserReport
+	 */
+	@Override
+	@Transactional
+	public void delete(WebsiteUserReport websiteUserReport) {
+		super.delete(websiteUserReport);
+	}
+	
+}

+ 95 - 0
modules/report/src/main/java/com/jeesite/modules/report/web/WebsiteUserReportController.java

@@ -0,0 +1,95 @@
+package com.jeesite.modules.report.web;
+
+import com.jeesite.common.config.Global;
+import com.jeesite.common.entity.Page;
+import com.jeesite.common.web.BaseController;
+import com.jeesite.modules.report.entity.WebsiteUserReport;
+import com.jeesite.modules.report.service.WebsiteUserReportService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 发送网站用户报告Controller
+ * @author gmj
+ * @version 2026-01-08
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/website/websiteUserReport")
+public class WebsiteUserReportController extends BaseController {
+
+	@Autowired
+	private WebsiteUserReportService websiteUserReportService;
+	
+	/**
+	 * 获取数据
+	 */
+	@ModelAttribute
+	public WebsiteUserReport get(String id, boolean isNewRecord) {
+		return websiteUserReportService.get(id, isNewRecord);
+	}
+	
+	/**
+	 * 查询列表
+	 */
+	@RequiresPermissions("website:websiteUserReport:view")
+	@RequestMapping(value = {"list", ""})
+	public String list(WebsiteUserReport websiteUserReport, Model model) {
+		model.addAttribute("websiteUserReport", websiteUserReport);
+		return "report/website/websiteUserReportList";
+	}
+	
+	/**
+	 * 查询列表数据
+	 */
+	@RequiresPermissions("website:websiteUserReport:view")
+	@RequestMapping(value = "listData")
+	@ResponseBody
+	public Page<WebsiteUserReport> listData(WebsiteUserReport websiteUserReport, HttpServletRequest request, HttpServletResponse response) {
+		websiteUserReport.setPage(new Page<>(request, response));
+		Page<WebsiteUserReport> page = websiteUserReportService.findPage(websiteUserReport);
+		return page;
+	}
+
+	/**
+	 * 查看编辑表单
+	 */
+	@RequiresPermissions("website:websiteUserReport:view")
+	@RequestMapping(value = "form")
+	public String form(WebsiteUserReport websiteUserReport, Model model) {
+		model.addAttribute("websiteUserReport", websiteUserReport);
+		return "report/website/websiteUserReportForm";
+	}
+
+	/**
+	 * 保存数据
+	 */
+	@RequiresPermissions("website:websiteUserReport:edit")
+	@PostMapping(value = "save")
+	@ResponseBody
+	public String save(@Validated WebsiteUserReport websiteUserReport) {
+		websiteUserReportService.save(websiteUserReport);
+		return renderResult(Global.TRUE, text("保存发送网站用户报告成功!"));
+	}
+	
+	/**
+	 * 删除数据
+	 */
+	@RequiresPermissions("website:websiteUserReport:edit")
+	@RequestMapping(value = "delete")
+	@ResponseBody
+	public String delete(WebsiteUserReport websiteUserReport) {
+		websiteUserReportService.delete(websiteUserReport);
+		return renderResult(Global.TRUE, text("删除发送网站用户报告成功!"));
+	}
+	
+}

+ 15 - 0
modules/report/src/main/resources/mappings/modules/report/WebsiteUserReportDao.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeesite.modules.report.dao.WebsiteUserReportDao">
+	
+	<!-- 查询数据
+	<select id="findList" resultType="WebsiteUserReport">
+		SELECT ${sqlMap.column.toSql()}
+		FROM ${sqlMap.table.toSql()}
+		<where>
+			${sqlMap.where.toSql()}
+		</where>
+		ORDER BY ${sqlMap.order.toSql()}
+	</select> -->
+	
+</mapper>