| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | dto.setUserId(null); |
| | | } |
| | | List<FilmWorksVO> list = filmWorksMapper.queryPage(dto,page); |
| | | // 测试前端展示用代码,部署发布不适用 |
| | | // list.forEach(l->{ |
| | | // if (l.getCoverUrl().contains("doubanio")) { |
| | | // String encodedUrl = null; |
| | | // try { |
| | | // encodedUrl = URLEncoder.encode(l.getCoverUrl(), String.valueOf(StandardCharsets.UTF_8)); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // l.setCoverUrl("https://images.weserv.nl/?url=" + encodedUrl); |
| | | // } |
| | | // }); |
| | | page.setRecords(list); |
| | | |
| | | |
| | |
| | | filmWorksMapper.updateById(filmWork); |
| | | }else{ |
| | | throw new ValidationException("非审核通过或者发布状态,不能操作"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void changeCreateStatus(Long id) { |
| | | //获取当前人员角色,判断是不是审核角色 |
| | | List<String> roleIds = new ArrayList<>(); |
| | | List<Role> roleList = roleService.getUserRoleList(SecurityUtils.getUserId()); |
| | | for (Role role : roleList) { |
| | | roleIds.add(role.getId()); |
| | | } |
| | | if (!roleIds.contains("8f9ef89f6b2d4d8e9ea1fc8d2f25ce69")) { |
| | | throw new ValidationException("非编辑角色不能操作"); |
| | | } |
| | | FilmWorks filmWork = filmWorksMapper.selectById(id); |
| | | if (filmWork == null) { |
| | | throw new ValidationException("找不到id为" + id + "的作品"); |
| | | } |
| | | if (Constants.COMMON_PUBLISH_STATUS.pending_create.name().equals(filmWork.getStatus()) || Constants.COMMON_PUBLISH_STATUS.create_cancel.name().equals(filmWork.getStatus()) || Constants.COMMON_PUBLISH_STATUS.create_failed.name().equals(filmWork.getStatus())) { |
| | | if (Constants.COMMON_PUBLISH_STATUS.create_cancel.name().equals(filmWork.getStatus())) { |
| | | filmWork.setStatus(Constants.COMMON_PUBLISH_STATUS.pending_create.name()); |
| | | } else if (Constants.COMMON_PUBLISH_STATUS.create_failed.name().equals(filmWork.getStatus())) { |
| | | filmWork.setStatus(Constants.COMMON_PUBLISH_STATUS.pending_create.name()); |
| | | } else { |
| | | filmWork.setStatus(Constants.COMMON_PUBLISH_STATUS.create_cancel.name()); |
| | | filmWork.setPublishDate(LocalDate.now()); |
| | | } |
| | | filmWorksMapper.updateById(filmWork); |
| | | }else{ |
| | | throw new ValidationException("当前状态,不能操作"); |
| | | } |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(filmWorksVO.getCreateBy()); |
| | | filmWorksVO.setNickname(currentCustomer.getNickName()); |
| | | filmWorksVO.setAvatar(currentCustomer.getCover()); |
| | | if(!ObjectUtils.isEmpty(currentCustomer)){ |
| | | filmWorksVO.setNickname(currentCustomer.getNickName()); |
| | | filmWorksVO.setAvatar(currentCustomer.getCover()); |
| | | } |
| | | |
| | | return filmWorksVO; |
| | | } |
| | | |