From 2b65f9f9d8dacc6700f23c968364b0df85d00bb0 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Fri, 6 May 2022 16:49:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 20 ++- .../controller/WorkDynamicsController.java | 116 ++++++++++++++++++ .../workDynamics/dao/WorkDynamicsDao.java | 16 +++ .../workDynamics/dto/WorkDynamicsDTO.java | 50 ++++++++ .../entity/WorkDynamicsEntity.java | 81 ++++++++++++ .../workDynamics/excel/WorkDynamicsExcel.java | 49 ++++++++ .../service/WorkDynamicsService.java | 15 +++ .../service/impl/WorkDynamicsServiceImpl.java | 34 +++++ .../mapper/workDynamics/WorkDynamicsDao.xml | 23 ++++ 9 files changed, 401 insertions(+), 3 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/controller/WorkDynamicsController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/dao/WorkDynamicsDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/dto/WorkDynamicsDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/entity/WorkDynamicsEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/excel/WorkDynamicsExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/service/WorkDynamicsService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java create mode 100644 renren-admin/src/main/resources/mapper/workDynamics/WorkDynamicsDao.xml diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 446db103..e1b18c03 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -246,10 +246,24 @@ public class ResourceServiceImpl extends CrudServiceImpl applyAreaList = resourceDao.selectApplyArea(userId); - //1.没有收藏和申请过,按最热能力选取 + //没有收藏和申请过,按最热能力选取,否则根据应用领域最多类型推荐 if (applyAreaList.isEmpty()) { - + JSONObject object = new JSONObject(); + object.put("pageNum", 1); + object.put("pageSize", 6); + return this.selectMostPopular(object); + } else { + ResourceDTO resourceDTO = new ResourceDTO(); + ArrayList list = new ArrayList<>(); + AttrEntity attrEntity = new AttrEntity(); + attrEntity.setAttrType("应用领域"); + attrEntity.setAttrValue(applyAreaList.get(0).get("attr_value").toString()); + list.add(attrEntity); + resourceDTO.setInfoList(list); + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(resourceDTO)); + jsonObject.put("pageNum", 1); + jsonObject.put("pageSize", 6); + return this.pageWithAttrs(jsonObject); } - return null; } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/controller/WorkDynamicsController.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/controller/WorkDynamicsController.java new file mode 100644 index 00000000..18eaee7f --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/controller/WorkDynamicsController.java @@ -0,0 +1,116 @@ +package io.renren.modules.workDynamics.controller; + +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.workDynamics.dto.WorkDynamicsDTO; +import io.renren.modules.workDynamics.excel.WorkDynamicsExcel; +import io.renren.modules.workDynamics.service.WorkDynamicsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** +* 工作动态 +* +* @author dg +* @since 1.0 2022-05-06 +*/ +@RestController +@RequestMapping("workDynamics/workdynamics") +@Api(tags="工作动态") +public class WorkDynamicsController { + @Autowired + private WorkDynamicsService workDynamicsService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + }) + //@RequiresPermissions("workDynamics:workdynamics:page") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = workDynamicsService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + //@RequiresPermissions("workDynamics:workdynamics:info") + public Result get(@PathVariable("id") Long id){ + WorkDynamicsDTO data = workDynamicsService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") + //@RequiresPermissions("workDynamics:workdynamics:save") + public Result save(@RequestBody WorkDynamicsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + workDynamicsService.save(dto); + + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") + //@RequiresPermissions("workDynamics:workdynamics:update") + public Result update(@RequestBody WorkDynamicsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + workDynamicsService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") + //@RequiresPermissions("workDynamics:workdynamics:delete") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + workDynamicsService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") + //@RequiresPermissions("workDynamics:workdynamics:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = workDynamicsService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "工作动态", list, WorkDynamicsExcel.class); + } + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/dao/WorkDynamicsDao.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/dao/WorkDynamicsDao.java new file mode 100644 index 00000000..95d8d94e --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/dao/WorkDynamicsDao.java @@ -0,0 +1,16 @@ +package io.renren.modules.workDynamics.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.workDynamics.entity.WorkDynamicsEntity; +import org.apache.ibatis.annotations.Mapper; + +/** +* 工作动态 +* +* @author dg +* @since 1.0 2022-05-06 +*/ +@Mapper +public interface WorkDynamicsDao extends BaseDao { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/dto/WorkDynamicsDTO.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/dto/WorkDynamicsDTO.java new file mode 100644 index 00000000..655cf10d --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/dto/WorkDynamicsDTO.java @@ -0,0 +1,50 @@ +package io.renren.modules.workDynamics.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* 工作动态 +* +* @author dg +* @since 1.0 2022-05-06 +*/ +@Data +@ApiModel(value = "工作动态") +public class WorkDynamicsDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "标题") + private String title; + @ApiModelProperty(value = "导航图保存地址") + private String imageUrl; + @ApiModelProperty(value = "文件地址") + private String fileUrl; + @ApiModelProperty(value = "删除标志:0:正常,1:删除,9:其他") + private Integer delFalg; + @ApiModelProperty(value = "创建人") + private Long creator; + @ApiModelProperty(value = "创建时间") + private Date createDate; + @ApiModelProperty(value = "修改人") + private Long updater; + @ApiModelProperty(value = "修改时间") + private Date updateDate; + @ApiModelProperty(value = "备用字段1") + private String note1; + @ApiModelProperty(value = "备用字段2") + private String note2; + @ApiModelProperty(value = "备用字段3") + private String note3; + @ApiModelProperty(value = "备用字段4") + private String note4; + @ApiModelProperty(value = "备用字段5") + private String note5; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/entity/WorkDynamicsEntity.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/entity/WorkDynamicsEntity.java new file mode 100644 index 00000000..61c8d229 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/entity/WorkDynamicsEntity.java @@ -0,0 +1,81 @@ +package io.renren.modules.workDynamics.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.*; +import java.util.Date; + +/** + * 工作动态 + * + * @author dg + * @since 1.0 2022-05-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_work_dynamics") +public class WorkDynamicsEntity { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId + private Long id; + /** + * 标题 + */ + private String title; + /** + * 导航图保存地址 + */ + private String imageUrl; + /** + * 文件地址 + */ + private String fileUrl; + /** + * 删除标志:0:正常,1:删除,9:其他 + */ + private Integer delFalg; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private Long creator; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createDate; + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updater; + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateDate; + /** + * 备用字段1 + */ + private String note1; + /** + * 备用字段2 + */ + private String note2; + /** + * 备用字段3 + */ + private String note3; + /** + * 备用字段4 + */ + private String note4; + /** + * 备用字段5 + */ + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/excel/WorkDynamicsExcel.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/excel/WorkDynamicsExcel.java new file mode 100644 index 00000000..5baeff92 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/excel/WorkDynamicsExcel.java @@ -0,0 +1,49 @@ +package io.renren.modules.workDynamics.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; +import java.util.Date; + +/** + * 工作动态 + * + * @author dg + * @since 1.0 2022-05-06 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class WorkDynamicsExcel { + @ExcelProperty(value = "id", index = 0) + private Long id; + @ExcelProperty(value = "标题", index = 1) + private String title; + @ExcelProperty(value = "导航图保存地址", index = 2) + private String imageUrl; + @ExcelProperty(value = "文件地址", index = 3) + private String fileUrl; + @ExcelProperty(value = "删除标志:0:正常,1:删除,9:其他", index = 4) + private Integer delFalg; + @ExcelProperty(value = "创建人", index = 5) + private Long creator; + @ExcelProperty(value = "创建时间", index = 6) + private Date createDate; + @ExcelProperty(value = "修改人", index = 7) + private Long updater; + @ExcelProperty(value = "修改时间", index = 8) + private Date updateDate; + @ExcelProperty(value = "备用字段1", index = 9) + private String note1; + @ExcelProperty(value = "备用字段2", index = 10) + private String note2; + @ExcelProperty(value = "备用字段3", index = 11) + private String note3; + @ExcelProperty(value = "备用字段4", index = 12) + private String note4; + @ExcelProperty(value = "备用字段5", index = 13) + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/service/WorkDynamicsService.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/service/WorkDynamicsService.java new file mode 100644 index 00000000..f45d0b0f --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/service/WorkDynamicsService.java @@ -0,0 +1,15 @@ +package io.renren.modules.workDynamics.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.workDynamics.dto.WorkDynamicsDTO; +import io.renren.modules.workDynamics.entity.WorkDynamicsEntity; + +/** + * 工作动态 + * + * @author dg + * @since 1.0 2022-05-06 + */ +public interface WorkDynamicsService extends CrudService { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java new file mode 100644 index 00000000..9d56135c --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/workDynamics/service/impl/WorkDynamicsServiceImpl.java @@ -0,0 +1,34 @@ +package io.renren.modules.workDynamics.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.common.constant.Constant; +import io.renren.modules.workDynamics.dao.WorkDynamicsDao; +import io.renren.modules.workDynamics.dto.WorkDynamicsDTO; +import io.renren.modules.workDynamics.entity.WorkDynamicsEntity; +import io.renren.modules.workDynamics.service.WorkDynamicsService; +import io.renren.modules.security.user.SecurityUser; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 工作动态 + * + * @author dg + * @since 1.0 2022-05-06 + */ +@Service +public class WorkDynamicsServiceImpl extends CrudServiceImpl implements WorkDynamicsService { + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + +} \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/workDynamics/WorkDynamicsDao.xml b/renren-admin/src/main/resources/mapper/workDynamics/WorkDynamicsDao.xml new file mode 100644 index 00000000..94282efa --- /dev/null +++ b/renren-admin/src/main/resources/mapper/workDynamics/WorkDynamicsDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file