新增工作动态

This commit is contained in:
dinggang 2022-05-06 16:49:09 +08:00
parent d957021bd2
commit 2b65f9f9d8
9 changed files with 401 additions and 3 deletions

View File

@ -246,10 +246,24 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Long userId = SecurityUser.getUser().getId();
//根据用户收藏和申请数据查出应用领域排名在根据应用领域查询热门能力推荐给用户
List<Map> 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<AttrEntity> 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;
}
}

View File

@ -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<PageData<WorkDynamicsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<WorkDynamicsDTO> page = workDynamicsService.page(params);
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
//@RequiresPermissions("workDynamics:workdynamics:info")
public Result<WorkDynamicsDTO> get(@PathVariable("id") Long id){
WorkDynamicsDTO data = workDynamicsService.get(id);
return new Result<WorkDynamicsDTO>().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<String, Object> params, HttpServletResponse response) throws Exception {
List<WorkDynamicsDTO> list = workDynamicsService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "工作动态", list, WorkDynamicsExcel.class);
}
}

View File

@ -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<WorkDynamicsEntity> {
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<WorkDynamicsEntity, WorkDynamicsDTO> {
}

View File

@ -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<WorkDynamicsDao, WorkDynamicsEntity, WorkDynamicsDTO> implements WorkDynamicsService {
@Override
public QueryWrapper<WorkDynamicsEntity> getWrapper(Map<String, Object> params){
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}

View File

@ -0,0 +1,23 @@
<?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="io.renren.modules.workDynamics.dao.WorkDynamicsDao">
<resultMap type="io.renren.modules.workDynamics.entity.WorkDynamicsEntity" id="workDynamicsMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="imageUrl" column="image_url"/>
<result property="fileUrl" column="file_url"/>
<result property="delFalg" column="del_falg"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
</mapper>