|
|
@@ -10,6 +10,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.AddressDefaultTypeEnum;
|
|
|
+import com.sckw.core.model.enums.ContractStatusEnum;
|
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
@@ -19,6 +20,7 @@ import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.operation.model.vo.req.BannerAddReqVo;
|
|
|
+import com.sckw.operation.model.vo.req.BannerUpdateStatusReqVo;
|
|
|
import com.sckw.operation.model.vo.res.*;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.operation.dao.KwoBannerMapper;
|
|
|
@@ -28,7 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.sckw.operation.model.entity.KwoBanner;
|
|
|
-import com.sckw.core.model.enums.bannerDistrictEnum;
|
|
|
+import com.sckw.core.model.enums.BannerDistrictEnum;
|
|
|
|
|
|
/**
|
|
|
* @author sky
|
|
|
@@ -119,7 +121,7 @@ public class BannerService {
|
|
|
}
|
|
|
|
|
|
if (Objects.nonNull(item.getDistrict())) {
|
|
|
- bannerQueryResVo.setDistrictName(bannerDistrictEnum.getName(item.getDistrict()).getName());
|
|
|
+ bannerQueryResVo.setDistrictName(BannerDistrictEnum.getName(item.getDistrict()).getName());
|
|
|
}
|
|
|
|
|
|
list.add(bannerQueryResVo);
|
|
|
@@ -218,4 +220,45 @@ public class BannerService {
|
|
|
return bannerDetailResVo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return HttpResult
|
|
|
+ * @desc: 获取分类
|
|
|
+ * @author: sky
|
|
|
+ * @date: 2023/7/12
|
|
|
+ */
|
|
|
+ public List<BannerCategoryResVo> getCategory() {
|
|
|
+ BannerDistrictEnum[] values = BannerDistrictEnum.values();
|
|
|
+ List<BannerCategoryResVo> list = new ArrayList<>();
|
|
|
+ for (BannerDistrictEnum bannerDistrictEnum : values) {
|
|
|
+ BannerCategoryResVo bannerCategoryResVo = new BannerCategoryResVo();
|
|
|
+ bannerCategoryResVo.setCode(bannerDistrictEnum.getCode());
|
|
|
+ bannerCategoryResVo.setName(bannerDistrictEnum.getName());
|
|
|
+ list.add(bannerCategoryResVo);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param reqVo 上架下架入参
|
|
|
+ * @desc: 更新banner
|
|
|
+ * @author: sky
|
|
|
+ * @date: 2023/8/29
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = {})
|
|
|
+ public void updateStatusServer(BannerUpdateStatusReqVo reqVo) {
|
|
|
+ KwoBanner kwobanner = kwoBannerMapper.selectById(reqVo.getId());
|
|
|
+ if (Objects.isNull(kwobanner)) {
|
|
|
+ throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.BANNER_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ //BeanUtils.copyProperties(reqVo, kwobanner);
|
|
|
+ Date date = new Date();
|
|
|
+ Long userId = LoginUserHolder.getUserId();
|
|
|
+ kwobanner.setUpdateTime(date);
|
|
|
+ kwobanner.setUpdateBy(userId);
|
|
|
+ kwobanner.setStatus(reqVo.getStatus());
|
|
|
+ if (kwoBannerMapper.updateById(kwobanner) <= 0) {
|
|
|
+ throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|