jiangping
2025-07-01 fc341ea66b1affaadec30cb0e0b690855c30b304
server/src/main/java/com/doumee/service/business/impl/InformationServiceImpl.java
@@ -44,12 +44,12 @@
    public Integer create(Information information) {
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(Objects.isNull(information)
                || Objects.isNull(information.getSortnum())
                || Objects.isNull(information.getReleaseDate())
//                || Objects.isNull(information.getSortnum())
//                || Objects.isNull(information.getReleaseDate())
                || StringUtils.isEmpty(information.getTitle())
                || StringUtils.isEmpty(information.getContnet())
                || StringUtils.isEmpty(information.getDescribe())
                || StringUtils.isEmpty(information.getImgurl())
//                || StringUtils.isEmpty(information.getContent())
//                || StringUtils.isEmpty(information.getDetail())
//                || StringUtils.isEmpty(information.getImgurl())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
@@ -62,7 +62,7 @@
    @Override
    public void deleteById(Integer id) {
        informationMapper.update(new UpdateWrapper<Information>().lambda().set(Information::getIsdeleted,Constants.ZERO).eq(Information::getId,id));
        informationMapper.update(new UpdateWrapper<Information>().lambda().set(Information::getIsdeleted,Constants.ONE).eq(Information::getId,id));
    }
    @Override
@@ -84,12 +84,12 @@
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(Objects.isNull(information)
                || Objects.isNull(information.getId())
                || Objects.isNull(information.getSortnum())
                || Objects.isNull(information.getReleaseDate())
//                || Objects.isNull(information.getSortnum())
//                || Objects.isNull(information.getReleaseDate())
                || StringUtils.isEmpty(information.getTitle())
                || StringUtils.isEmpty(information.getContnet())
                || StringUtils.isEmpty(information.getDescribe())
                || StringUtils.isEmpty(information.getImgurl())
//                || StringUtils.isEmpty(information.getContent())
//                || StringUtils.isEmpty(information.getDetail())
//                || StringUtils.isEmpty(information.getImgurl())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
@@ -139,12 +139,14 @@
        queryWrapper.lambda()
                .eq(Information::getIsdeleted,Constants.ZERO)
                .eq(pageWrap.getModel().getId() != null, Information::getId, pageWrap.getModel().getId())
                .eq(pageWrap.getModel().getStatus() != null, Information::getStatus, pageWrap.getModel().getStatus())
                .eq(pageWrap.getModel().getRemark() != null, Information::getRemark, pageWrap.getModel().getRemark())
                .eq(pageWrap.getModel().getTitle() != null, Information::getTitle, pageWrap.getModel().getTitle())
                .eq(pageWrap.getModel().getDescribe() != null, Information::getDescribe, pageWrap.getModel().getDescribe())
                .eq(pageWrap.getModel().getContnet() != null, Information::getContnet, pageWrap.getModel().getContnet())
                .like(pageWrap.getModel().getTitle() != null, Information::getTitle, pageWrap.getModel().getTitle())
                .like(pageWrap.getModel().getDetail() != null, Information::getDetail, pageWrap.getModel().getDetail())
                .like(pageWrap.getModel().getContent() != null, Information::getContent, pageWrap.getModel().getContent())
                .ge(pageWrap.getModel().getReleaseDate() != null, Information::getReleaseDate, Utils.Date.getStart(pageWrap.getModel().getReleaseDate()))
                .le(pageWrap.getModel().getReleaseDate() != null, Information::getReleaseDate, Utils.Date.getEnd(pageWrap.getModel().getReleaseDate()))
                .orderByDesc(Information::getSortnum)
        ;
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
@@ -156,7 +158,7 @@
        IPage<Information> iPage =  informationMapper.selectPage(page, queryWrapper);
        String fileDir = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode();
        for (Information information:iPage.getRecords()) {
            if(Objects.isNull(information)&& org.apache.commons.lang3.StringUtils.isNotBlank(information.getImgurl())){
            if(!Objects.isNull(information)&& org.apache.commons.lang3.StringUtils.isNotBlank(information.getImgurl())){
                information.setFullImgurl(fileDir + information.getImgurl());
            }
        }
@@ -168,4 +170,19 @@
        QueryWrapper<Information> wrapper = new QueryWrapper<>(information);
        return informationMapper.selectCount(wrapper);
    }
    @Override
    public void updateStatus(Information information){
        if(Objects.isNull(information)
                || Objects.isNull(information.getStatus())
                || Objects.isNull(information.getId())
                || !(Constants.equalsInteger(information.getStatus(),Constants.ZERO)
                || Constants.equalsInteger(information.getStatus(),Constants.ONE))
        ){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        informationMapper.update(new UpdateWrapper<Information>().lambda().set(Information::getStatus,information.getStatus()).eq(Information::getId,information.getId()));
    }
}