提交案例推荐表设计

This commit is contained in:
Guava
2023-06-17 09:55:07 +08:00
parent 58a6427ad4
commit 7e9f78ccda
7 changed files with 223 additions and 29 deletions

View File

@@ -1,23 +1,27 @@
package com.xboe.module.boecase.api;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.xboe.common.PageList;
import com.xboe.common.Pagination;
import com.xboe.core.JsonResponse;
import com.xboe.core.api.ApiBaseController;
import com.xboe.module.boecase.entity.CasesRecommend;
import com.xboe.module.boecase.service.ICasesRecommendLaunchImportService;
import com.xboe.module.boecase.service.ICasesRecommendService;
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
import com.xboe.module.boecase.vo.CasesRecommendVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
/**
* 案例推荐表
* */
*/
@Slf4j
@RestController
@RequestMapping(value = "xboe/m/boe/cases/recommend")
@@ -26,14 +30,18 @@ public class CasesRecommendApi extends ApiBaseController {
@Resource
private ICasesRecommendService iCasesRecommendService;
@Resource
private ICasesRecommendLaunchImportService iCasesRecommendLaunchImportService;
/**
* 用于后台管理分页
*
* @param pager
* @param casesRecommendVo
* @return
*/
@PostMapping("/page")
public JsonResponse<PageList<CasesRecommend>> page(Pagination pager, CasesRecommendVo casesRecommendVo){
public JsonResponse<PageList<CasesRecommend>> page(Pagination pager, CasesRecommendVo casesRecommendVo) {
PageList<CasesRecommend> page = iCasesRecommendService.page(pager.getPageIndex(), pager.getPageSize(), casesRecommendVo);
return success(page);
}
@@ -47,10 +55,51 @@ public class CasesRecommendApi extends ApiBaseController {
iCasesRecommendService.delete(id);
return success(true);
} catch (Exception e) {
log.error("删除失败",e);
return error("删除失败",e.getMessage());
log.error("删除失败", e);
return error("删除失败", e.getMessage());
}
}
/**
* 导入
*
* @param file
* @return
* @throws Exception
*/
@PostMapping("/import")
public JsonResponse<String> excelImport(@RequestParam("file") MultipartFile file) throws Exception {
ExcelReader reader = ExcelUtil.getReader(file.getInputStream());
List<List<Object>> read = reader.read();
return success(null);
}
/**
* 下载错误数据
*
* @return
* @throws Exception
*/
@GetMapping("/download")
public void download(String importId) {
}
/**
* 发起推送
*
* @param casesRecommendLaunch
* @return
*/
@PostMapping("/launch")
public JsonResponse<Boolean> excelImport(@RequestBody CasesRecommendLaunchVo casesRecommendLaunch) {
return success(true);
}
}

View File

@@ -1,16 +1,5 @@
package com.xboe.module.boecase.api;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import io.netty.util.internal.ObjectUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.xboe.common.utils.StringUtil;
import com.xboe.core.JsonResponse;
import com.xboe.core.api.ApiBaseController;
@@ -18,9 +7,14 @@ import com.xboe.core.log.AutoLog;
import com.xboe.module.boecase.dto.AcceptVo;
import com.xboe.module.boecase.entity.Recommend;
import com.xboe.module.boecase.service.IRecommendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.List;
/**
* 案例推荐表
@@ -61,13 +55,4 @@ public class RecommendApi extends ApiBaseController {
}
@PostMapping("/import")
public JsonResponse<String> excelImport(@RequestParam("file") MultipartFile file) throws Exception {
ExcelReader reader = ExcelUtil.getReader(file.getInputStream());
List<List<Object>> read = reader.read();
return success(null);
}
}

View File

@@ -0,0 +1,9 @@
package com.xboe.module.boecase.dao;
import com.xboe.core.orm.BaseDao;
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
import org.springframework.stereotype.Repository;
@Repository
public class CasesRecommendPushRecordDao extends BaseDao<CasesRecommendPushRecord> {
}

View File

@@ -0,0 +1,95 @@
package com.xboe.module.boecase.entity;
import com.xboe.core.SysConstant;
import com.xboe.core.orm.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 案例推荐发起导入
*/
@Data
@Entity
@EqualsAndHashCode(callSuper = false)
@Table(name = SysConstant.TABLE_PRE + "cases_recommend_push_record")
public class CasesRecommendPushRecord extends BaseEntity {
/**
* 推送id
*/
@Column(name = "recommend_id")
private String recommendId;
/**
* 案例id
*/
@Column(name = "case_id")
private String caseId;
/**
* 案例标题
*/
@Column(name = "case_title")
private String caseTitle;
/**
* 推送用户id
*/
@Column(name = "push_user_id")
private String pushUserId;
/**
* 推送用户名称
*/
@Column(name = "push_user_name")
private String pushUserName;
/**
* 推送状态1未推送2推送中3已推送4推送失败5已撤回
*/
@Column(name = "push_status")
private Integer pushStatus;
/**
* 推送时间
*/
@Column(name = "push_time")
private Integer pushTime;
/**
* 查看标识
*/
@Column(name = "read_flag")
private Integer readFlag;
/**
* 首次查看时间
*/
@Column(name = "read_start_time")
private Date readStartTime;
/**
* 最后查看时间
*/
@Column(name = "read_end_time")
private Date readEndTime;
/**
* 备注
*/
@Column(name = "remark")
private String remark;
}

View File

@@ -0,0 +1,5 @@
package com.xboe.module.boecase.service;
public interface ICasesRecommendPushRecordService {
}

View File

@@ -0,0 +1,11 @@
package com.xboe.module.boecase.service.impl;
import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class CasesRecommendPushRecordServiceImpl implements ICasesRecommendPushRecordService {
}

View File

@@ -0,0 +1,40 @@
package com.xboe.module.boecase.vo;
import lombok.Data;
import java.util.List;
/**
* @author : civism
* @version 1.0
* @date 2023/6/17 09:46
*/
@Data
public class CasesRecommendLaunchVo {
/**
* 发起类型 1 正常选择 2 文件导入
*/
private Integer launchType;
/**
* 如果launchType为2 必须传递 其他情况不用传递
*/
private String importId;
/**
* 推送的文章标题id launchType 为1必须传递 其他情况不用传递
*/
private List<String> casesIdList;
/**
* 推送的用户id
*/
private List<String> pushUserIdList;
/**
* 推荐机构
*/
private String recommendOrgName;
}