| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CarouselMapper; |
| | | import com.doumee.dao.business.model.Carousel; |
| | | import com.doumee.dao.dto.FootDataDTO; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.dao.vo.FootDataVO; |
| | | import com.doumee.service.business.CarouselService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.system.SystemDictDataService; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | | private SystemDictDataService systemDictDataService; |
| | | |
| | | @Override |
| | | public Integer create(Carousel carousel) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(carousel) |
| | | || Objects.isNull(carousel.getType()) |
| | | || Objects.isNull(carousel.getImgurl()) |
| | | // || Objects.isNull(carousel.getImgurl()) |
| | | || Objects.isNull(carousel.getJumpType()) |
| | | || Objects.isNull(carousel.getSortnum()) |
| | | || (!Constants.equalsInteger(carousel.getJumpType(),Constants.ZERO) && StringUtils.isEmpty(carousel.getContnet())) |
| | | // || Objects.isNull(carousel.getSortnum()) |
| | | || StringUtils.isEmpty(carousel.getTitle()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | carousel.setType(Constants.ZERO); |
| | | carousel.setIsdeleted(Constants.ZERO); |
| | | carousel.setStatus(Constants.ZERO); |
| | | carousel.setCreateDate(new Date()); |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(carousel) |
| | | || Objects.isNull(carousel.getId()) |
| | | || Objects.isNull(carousel.getType()) |
| | | || Objects.isNull(carousel.getImgurl()) |
| | | || Objects.isNull(carousel.getJumpType()) |
| | | || Objects.isNull(carousel.getSortnum()) |
| | | || (!Constants.equalsInteger(carousel.getJumpType(),Constants.ZERO) && StringUtils.isEmpty(carousel.getContnet())) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | .eq(pageWrap.getModel().getId() != null, Carousel::getId, pageWrap.getModel().getId()) |
| | | .eq(pageWrap.getModel().getRemark() != null, Carousel::getRemark, pageWrap.getModel().getRemark()) |
| | | .like(pageWrap.getModel().getTitle() != null, Carousel::getTitle, pageWrap.getModel().getTitle()) |
| | | .like(pageWrap.getModel().getDescribe() != null, Carousel::getDescribe, pageWrap.getModel().getDescribe()) |
| | | .like(pageWrap.getModel().getDetail() != null, Carousel::getDetail, pageWrap.getModel().getDetail()) |
| | | .eq(pageWrap.getModel().getType() != null, Carousel::getType, pageWrap.getModel().getType()) |
| | | .eq(pageWrap.getModel().getJumpType() != null, Carousel::getJumpType, pageWrap.getModel().getJumpType()) |
| | | .eq(pageWrap.getModel().getContnet() != null, Carousel::getContnet, pageWrap.getModel().getContnet()) |
| | | .like(pageWrap.getModel().getContent() != null, Carousel::getContent, pageWrap.getModel().getContent()) |
| | | .eq(pageWrap.getModel().getSortnum() != null, Carousel::getSortnum, pageWrap.getModel().getSortnum()) |
| | | .eq(pageWrap.getModel().getStatus() != null, Carousel::getStatus, pageWrap.getModel().getStatus()) |
| | | .orderByDesc(Carousel::getSortnum) |
| | | |
| | | ; |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | |
| | | QueryWrapper<Carousel> wrapper = new QueryWrapper<>(carousel); |
| | | return carouselMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public FootDataVO getFoodDataVO(){ |
| | | FootDataVO footDataVO = new FootDataVO(); |
| | | footDataVO.setFootWords(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FOOT_WORDS).getCode()); |
| | | footDataVO.setFootImgUrl(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FOOT_IMGURL).getCode()); |
| | | footDataVO.setFootFullImgUrl(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FOOT_IMGURL).getCode()); |
| | | footDataVO.setAddress(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ADDRESS).getCode()); |
| | | footDataVO.setLinkPhone(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.LINK_PHONE).getCode()); |
| | | footDataVO.setLinkMobile(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.LINK_MOBILE).getCode()); |
| | | SystemDictData solveScheme = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SOLVE_SCHEME); |
| | | if(Objects.nonNull(solveScheme) & org.apache.commons.lang3.StringUtils.isNotBlank(solveScheme.getCode())){ |
| | | footDataVO.setSolveScheme(JSONArray.parseArray(solveScheme.getCode())); |
| | | } |
| | | SystemDictData wisdomSystem = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.WISDOM_SYSTEM); |
| | | if(Objects.nonNull(wisdomSystem) & org.apache.commons.lang3.StringUtils.isNotBlank(wisdomSystem.getCode())){ |
| | | footDataVO.setWisdomSystem(JSONArray.parseArray(wisdomSystem.getCode())); |
| | | } |
| | | footDataVO.setServerTime(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SERVER_TIME).getCode()); |
| | | return footDataVO; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public void updFoodDataVO(FootDataDTO footDataDTO) { |
| | | SystemDictData footWords = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FOOT_WORDS); |
| | | if (Objects.nonNull(footWords)) { |
| | | footWords.setCode(footDataDTO.getFootWords()); |
| | | systemDictDataBiz.updateById(footWords); |
| | | } |
| | | |
| | | SystemDictData footImgUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FOOT_IMGURL); |
| | | if (Objects.nonNull(footImgUrl)) { |
| | | footImgUrl.setCode(footDataDTO.getFootImgUrl()); |
| | | systemDictDataBiz.updateById(footImgUrl); |
| | | } |
| | | |
| | | SystemDictData linkPhone = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.LINK_PHONE); |
| | | if (Objects.nonNull(linkPhone)) { |
| | | linkPhone.setCode(footDataDTO.getLinkPhone()); |
| | | systemDictDataBiz.updateById(linkPhone); |
| | | } |
| | | |
| | | SystemDictData linkMobile = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.LINK_MOBILE); |
| | | if (Objects.nonNull(linkMobile)) { |
| | | linkMobile.setCode(footDataDTO.getLinkMobile()); |
| | | systemDictDataBiz.updateById(linkMobile); |
| | | } |
| | | |
| | | SystemDictData serverTime = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.SERVER_TIME); |
| | | if (Objects.nonNull(serverTime)) { |
| | | serverTime.setCode(footDataDTO.getServerTime()); |
| | | systemDictDataBiz.updateById(serverTime); |
| | | } |
| | | |
| | | SystemDictData address = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.ADDRESS); |
| | | if (Objects.nonNull(address)) { |
| | | address.setCode(footDataDTO.getAddress()); |
| | | systemDictDataBiz.updateById(address); |
| | | } |
| | | |
| | | SystemDictData solveScheme = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.SOLVE_SCHEME); |
| | | if (Objects.nonNull(solveScheme)&&Objects.nonNull(footDataDTO.getSolveScheme())) { |
| | | solveScheme.setCode(footDataDTO.getSolveScheme().toString()); |
| | | systemDictDataBiz.updateById(solveScheme); |
| | | } |
| | | |
| | | SystemDictData wisdomSystem = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.WISDOM_SYSTEM); |
| | | if (Objects.nonNull(wisdomSystem)&&Objects.nonNull(footDataDTO.getWisdomSystem())) { |
| | | wisdomSystem.setCode(footDataDTO.getWisdomSystem().toString()); |
| | | systemDictDataBiz.updateById(wisdomSystem); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |