Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-06 15:59:27 +08:00
commit 49d7d2d1f0
5 changed files with 52 additions and 29 deletions

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author Jone
@ -86,4 +87,17 @@ public class TaskDTO {
@ApiModelProperty(value = "流程直接被终止?")
private Boolean termination = null;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TaskDTO taskDTO = (TaskDTO) o;
return taskId.equals(taskDTO.taskId) && createTime.equals(taskDTO.createTime) && businessKey.equals(taskDTO.businessKey) && processDefinitionName.equals(taskDTO.processDefinitionName) && processDefinitionKey.equals(taskDTO.processDefinitionKey);
}
@Override
public int hashCode() {
return Objects.hash(taskId, createTime, businessKey, processDefinitionName, processDefinitionKey);
}
}

View File

@ -54,6 +54,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 任务管理
@ -176,11 +177,9 @@ public class ActTaskService extends BaseServiceImpl {
page.setTotal(0);
} else {
ArrayList<TaskDTO> recordLists = new ArrayList<>();
for (int i = (curPage - 1) * limit; i < j; i++) {
recordLists.add(taskDtoList.get(i));
}
recordLists.addAll(taskDtoList.stream().distinct().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()));
page.setRecords(recordLists);
page.setTotal(taskDtoList.size());
page.setTotal(taskDtoList.stream().distinct().count());
}
return page;
}

View File

@ -35,7 +35,6 @@ import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.renren.modules.resource.entity.TbDataResourceRelEntity;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.dao.ResourceBrowseDao;
import io.renren.modules.resourceBrowse.entity.ResourceBrowseEntity;
import io.renren.modules.resourceCar.dao.ResourceCarDao;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
@ -690,11 +689,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId())
.eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
resourceDao.update(entity, updateWrapper);
ResourceBrowseEntity browseEntity = new ResourceBrowseEntity();
browseEntity.setResourceId(id);
browseEntity.setUserId(SecurityUser.getUserId());
browseEntity.setState(0);
resourceBrowseDao.insert(browseEntity);
// ResourceBrowseEntity browseEntity = new ResourceBrowseEntity();
// browseEntity.setResourceId(id);
// browseEntity.setUserId(SecurityUser.getUserId());
// browseEntity.setState(0);
// resourceBrowseDao.insert(browseEntity);
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + id);

View File

@ -9,50 +9,53 @@ 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.resource.service.ResourceService;
import io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO;
import io.renren.modules.resourceBrowse.excel.ResourceBrowseExcel;
import io.renren.modules.resourceBrowse.service.ResourceBrowseService;
import io.renren.modules.security.user.SecurityUser;
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.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 浏览记录
*
* @author dg
* @since 1.0 2022-05-17
*/
* 浏览记录
*
* @author dg
* @since 1.0 2022-05-17
*/
@RestController
@RequestMapping("/resourceBrowse")
@Api(tags="浏览记录")
@Api(tags = "浏览记录")
public class ResourceBrowseController {
@Autowired
private ResourceBrowseService resourceBrowseService;
@Autowired
private ResourceService resourceService;
@Autowired
private JdbcTemplate jdbcTemplate;
@GetMapping("/page")
@ApiOperation("浏览记录-分页查询")
@LogOperation("浏览记录-分页查询")
@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"),
@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("resourceBrowse:resourcebrowse:page")
public Result<PageData<ResourceBrowseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
public Result<PageData<ResourceBrowseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<ResourceBrowseDTO> page = resourceBrowseService.page(params);
page.getList().forEach(item -> item.setResourceDTO(resourceService.get(item.getResourceId())));
return new Result<PageData<ResourceBrowseDTO>>().ok(page);
@ -62,7 +65,7 @@ public class ResourceBrowseController {
@ApiOperation("浏览记录-详细信息")
@LogOperation("浏览记录-详细信息")
//@RequiresPermissions("resourceBrowse:resourcebrowse:info")
public Result<ResourceBrowseDTO> get(@PathVariable("id") Long id){
public Result<ResourceBrowseDTO> get(@PathVariable("id") Long id) {
ResourceBrowseDTO data = resourceBrowseService.get(id);
return new Result<ResourceBrowseDTO>().ok(data);
@ -72,13 +75,19 @@ public class ResourceBrowseController {
@ApiOperation("保存浏览记录")
@LogOperation("保存浏览记录")
//@RequiresPermissions("resourceBrowse:resourcebrowse:save")
public Result save(@RequestBody ResourceBrowseDTO dto){
public Result save(@RequestBody ResourceBrowseDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
if (dto.getResourceId() != null) {
dto.setResourceDTO(resourceService.get(dto.getResourceId()));
}
dto.setState(0);
dto.setCreateDate(new Date());
dto.setCreator(SecurityUser.getUserId());
dto.setUserId(SecurityUser.getUserId());
resourceBrowseService.save(dto);
return new Result();
jdbcTemplate.update("UPDATE tb_data_resource SET visitor = (SELECT COUNT(id) FROM tb_resource_browse WHERE resource_id = tb_data_resource.id) WHERE tb_data_resource.id = " + dto.getResourceId());
return new Result().ok(dto);
}
//@PutMapping("/update")
@ -98,7 +107,7 @@ public class ResourceBrowseController {
@ApiOperation("批量删除浏览记录")
@LogOperation("批量删除浏览记录")
//@RequiresPermissions("resourceBrowse:resourcebrowse:delete")
public Result delete(@RequestBody Long[] ids){
public Result delete(@RequestBody Long[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

View File

@ -0,0 +1,2 @@
alter table `share_platform`.`tb_data_resource` ADD COLUMN `visitor` bigint NULL comment '浏览量';
UPDATE tb_data_resource SET visitor = (SELECT COUNT(id) FROM tb_resource_browse WHERE resource_id = tb_data_resource.id);