Merge remote-tracking branch 'origin/master'
# Conflicts: # ruoyi-service/src/main/java/com/ruoyi/bst/ad/domain/Ad.java # ruoyi-web/src/main/java/com/ruoyi/web/bst/AdController.java
This commit is contained in:
commit
a715642ef6
|
@ -1,13 +1,19 @@
|
|||
package com.ruoyi.bst.ad.domain;
|
||||
|
||||
import com.ruoyi.common.constants.DictType;
|
||||
import com.ruoyi.common.core.validate.ValidGroup;
|
||||
import com.ruoyi.common.valid.DictValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 广告对象 bst_ad
|
||||
|
@ -30,8 +36,8 @@ public class Ad extends BaseEntity implements LogBizParam
|
|||
@ApiModelProperty("广告类型 1:活动推广")
|
||||
private String type;
|
||||
|
||||
|
||||
@ApiModelProperty("广告图片")
|
||||
@NotBlank(message = "广告图片不能为空",groups = {ValidGroup.Create.class})
|
||||
private String picture;
|
||||
|
||||
@Excel(name = "运营商id")
|
||||
|
@ -40,14 +46,19 @@ public class Ad extends BaseEntity implements LogBizParam
|
|||
|
||||
@Excel(name = "运营区id")
|
||||
@ApiModelProperty("运营区id")
|
||||
@NotNull(message = "运营区ID不能为空", groups = {ValidGroup.Create.class})
|
||||
@Min(value = 1, message = "运营区ID需大于0")
|
||||
private Long areaId;
|
||||
|
||||
@Excel(name = "跳转链接")
|
||||
@ApiModelProperty("跳转链接")
|
||||
@NotBlank(message = "跳转链接不能为空", groups = {ValidGroup.Create.class})
|
||||
private String url;
|
||||
|
||||
@Excel(name = "跳转类型,1外链跳转,2站内跳转")
|
||||
@ApiModelProperty("跳转类型,1外链跳转,2站内跳转")
|
||||
@NotBlank(message = "跳转类型不能为空", groups = {ValidGroup.Create.class})
|
||||
@DictValid(type = DictType.URL_TYPE, message = "非法的跳转类型")
|
||||
private String urlType;
|
||||
|
||||
@Excel(name = "审核状态")
|
||||
|
|
|
@ -7,7 +7,7 @@ import lombok.Data;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AdQuery extends Ad{
|
||||
public class AdQuery extends AdVO{
|
||||
|
||||
@ApiModelProperty("广告ID列表")
|
||||
private List<Long> adIds;
|
||||
|
|
|
@ -9,7 +9,10 @@ public class AdVO extends Ad{
|
|||
@ApiModelProperty("所属运营区")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty("所属运营区")
|
||||
@ApiModelProperty("广告审核状态")
|
||||
private String auditStatus;
|
||||
|
||||
@ApiModelProperty("审核人")
|
||||
private String verifyName;
|
||||
|
||||
}
|
||||
|
|
|
@ -46,8 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.agent_id
|
||||
from bst_ad bad
|
||||
left join bst_area ba on bad.area_id = ba.id
|
||||
left join bst_order bo ON ba.id = bo.area_id
|
||||
left join sys_user su on bo.user_id = su.user_id
|
||||
left join sys_user su on ba.user_id = su.user_id
|
||||
left join sys_user su_verify on bad.verify_by = su_verify.user_id
|
||||
</sql>
|
||||
|
||||
|
|
|
@ -13,4 +13,6 @@ public interface AdConverter {
|
|||
AdQuery toAdAdminVO();
|
||||
|
||||
AdQuery toAdStoreVO();
|
||||
|
||||
Ad toPoByCreate(Ad ad);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ruoyi.bst.ad.domain.Ad;
|
|||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import com.ruoyi.bst.ad.enums.AdBlong;
|
||||
import com.ruoyi.bst.ad.service.AdConverter;
|
||||
import com.ruoyi.bst.area.domain.Area;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -34,4 +35,20 @@ public class AdConverterImpl implements AdConverter {
|
|||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ad toPoByCreate(Ad data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
Ad po = new Ad();
|
||||
// 基础信息
|
||||
po.setAreaId(data.getAreaId());
|
||||
po.setType(data.getType());
|
||||
po.setPicture(data.getPicture());
|
||||
po.setBelong(data.getBelong());
|
||||
po.setUrl(data.getUrl());
|
||||
po.setUrlType(data.getUrlType());
|
||||
return po;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,14 +80,18 @@ public class AdServiceImpl implements AdService
|
|||
@Override
|
||||
public int insertAd(Ad ad)
|
||||
{
|
||||
// 默认设置为商户广告
|
||||
if (ad.getBelong() == null || ad.getBelong().equals("")){
|
||||
ad.setBelong(AdBlong.STORE.getCode());
|
||||
}
|
||||
AdQuery query = new AdQuery();
|
||||
query.setAreaId(ad.getAreaId());
|
||||
if (ad.getAreaId() != null){
|
||||
// 商户广告存在上限
|
||||
if (ad.getBelong().equals(AdBlong.STORE.getCode())){
|
||||
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||
ad.setStoreId(area.getUserId());
|
||||
// 条件查询广告
|
||||
AdQuery query = new AdQuery();
|
||||
query.setAreaId(ad.getAreaId());
|
||||
query.setDeleted(false);
|
||||
ServiceUtil.assertion(adMapper.selectOne(query)!=null,"当前运营区存在广告已达上限");
|
||||
}
|
||||
ad.setCreateTime(DateUtils.getNowDate());
|
||||
|
@ -185,7 +189,6 @@ public class AdServiceImpl implements AdService
|
|||
data.setVerifyBy(SecurityUtils.getUserId());
|
||||
data.setVerifyEndTime(LocalDateTime.now());
|
||||
data.setVerifyRemark(dto.getVerifyRemark());
|
||||
data.setVerifyBy(SecurityUtils.getUserId());
|
||||
AdQuery query = new AdQuery();
|
||||
query.setAdId(dto.getId());
|
||||
query.setStatusList(AdVerifyStatus.canVerify());
|
||||
|
|
|
@ -12,7 +12,6 @@ public class AgreementQuery extends AgreementVO {
|
|||
@ApiModelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@ApiModelProperty("协议ID列表")
|
||||
private List<Long> ids;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface AgreementService
|
|||
* @param agreement 协议
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgreement(AgreementQuery agreement);
|
||||
public int insertAgreement(Agreement agreement);
|
||||
|
||||
/**
|
||||
* 修改协议
|
||||
|
|
|
@ -64,16 +64,9 @@ public class AgreementServiceImpl implements AgreementService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAgreement(AgreementQuery agreement)
|
||||
public int insertAgreement(Agreement agreement)
|
||||
{
|
||||
agreement.setCreateTime(DateUtils.getNowDate());
|
||||
UserVO user = userService.selectUserById(agreement.getUserId());
|
||||
if (user != null){
|
||||
if (user.getAreaId() != null){
|
||||
agreement.setAreaId(user.getAreaId());
|
||||
}
|
||||
agreement.setStoreId(agreement.getUserId());
|
||||
}
|
||||
distinct(agreement);
|
||||
return agreementMapper.insertAgreement(agreement);
|
||||
}
|
||||
|
@ -93,13 +86,8 @@ public class AgreementServiceImpl implements AgreementService
|
|||
}
|
||||
|
||||
private void distinct(Agreement agreement) {
|
||||
if (agreement.getAreaId() != null){
|
||||
AreaVO area = areaService.selectAreaById(agreement.getAreaId());
|
||||
ServiceUtil.assertion(area == null,"当前区域不存在");
|
||||
agreement.setStoreId(area.getUserId());
|
||||
ServiceUtil.assertion(agreementMapper.selectDistinct(agreement)!= null,"当前运营区已存在同类协议");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除协议
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.ruoyi.bst.article.domain;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ArticleQuery extends Article{
|
||||
public class ArticleQuery extends ArticleVO{
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ArticleCategoryQuery extends ArticleCategory {
|
||||
public class ArticleCategoryQuery extends ArticleCategoryVO {
|
||||
|
||||
@ApiModelProperty("指南编号")
|
||||
private String code;
|
||||
|
|
|
@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ComplaintQuery extends Complaint{
|
||||
public class ComplaintQuery extends ComplaintVO{
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String userName;
|
||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CustomerServiceQuery extends CustomerService{
|
||||
public class CustomerServiceQuery extends CustomerServiceVO{
|
||||
|
||||
@ApiModelProperty("客服ID列表")
|
||||
private List<Long> ids;
|
||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardwareVersionQuery extends HardwareVersion{
|
||||
public class HardwareVersionQuery extends HardwareVersionVO{
|
||||
|
||||
@ApiModelProperty("硬件版本列表")
|
||||
private List<Long> hardwareVersionIds;
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MchApplyQuery extends MchApply{
|
||||
public class MchApplyQuery extends MchApplyVO{
|
||||
|
||||
@ApiModelProperty("创建时间范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.bst.realName.domain;
|
||||
|
||||
public class RealNameQuery extends RealName{
|
||||
public class RealNameQuery extends RealNameVO{
|
||||
}
|
||||
|
|
|
@ -18,4 +18,6 @@ public class DictType {
|
|||
public static final String SUIT_TYPE = "suit_type";
|
||||
// 支付渠道类型
|
||||
public static final String CHANNEL_TYPE = "channel_type";
|
||||
// 广告跳转类型
|
||||
public static final String URL_TYPE = "ad_url_type";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.web.app;
|
||||
|
||||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import com.ruoyi.bst.ad.enums.AdVerifyStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -25,6 +26,7 @@ public class AppAdController extends BaseController {
|
|||
@Anonymous
|
||||
public AjaxResult getAd(AdQuery query) {
|
||||
query.setUserId(getUserId());
|
||||
query.setAuditStatus(AdVerifyStatus.PASSED.getCode());
|
||||
return success(adService.toAppVOList(query));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import com.ruoyi.bst.ad.domain.Ad;
|
|||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import com.ruoyi.bst.ad.domain.AdVO;
|
||||
import com.ruoyi.bst.ad.domain.AdVerifyDTO;
|
||||
import com.ruoyi.bst.ad.enums.AdBlong;
|
||||
import com.ruoyi.bst.ad.enums.AdVerifyStatus;
|
||||
import com.ruoyi.bst.ad.service.AdConverter;
|
||||
import com.ruoyi.bst.ad.service.AdService;
|
||||
import com.ruoyi.bst.ad.service.AdValidator;
|
||||
|
@ -28,6 +30,7 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.ValidGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.LogBizType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
@ -62,9 +65,9 @@ public class AdController extends BaseController
|
|||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
query.setDeleted(false);
|
||||
query.setUserId(getUserId());
|
||||
query.setScope(true);
|
||||
query.setUserId(getUserId());
|
||||
query.setDeleted(false);
|
||||
return getDataTable(adService.selectAdList(query));
|
||||
}
|
||||
|
||||
|
@ -97,8 +100,9 @@ public class AdController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('bst:ad:add')")
|
||||
@Log(title = "新增广告", businessType = BusinessType.INSERT, bizIdName = "arg0", bizType = LogBizType.AD)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Ad ad)
|
||||
public AjaxResult add(@Validated(ValidGroup.Create.class) @RequestBody Ad ad)
|
||||
{
|
||||
ad = adConverter.toPoByCreate(ad);
|
||||
return toAjax(adService.insertAd(ad));
|
||||
}
|
||||
|
||||
|
@ -108,7 +112,7 @@ public class AdController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('bst:ad:edit')")
|
||||
@Log(title = "修改广告", businessType = BusinessType.UPDATE, bizIdName = "arg0", bizType = LogBizType.AD)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Ad ad)
|
||||
public AjaxResult edit(@Validated(ValidGroup.Update.class)@RequestBody Ad ad)
|
||||
{
|
||||
if (!adValidator.canEdit(ad.getAdId())){
|
||||
return AjaxResult.error("您没有权限修改id为" + ad.getAdId() + "的广告信息");
|
||||
|
|
|
@ -86,9 +86,8 @@ public class AgreementController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('bst:agreement:add')")
|
||||
@Log(title = "新增协议", businessType = BusinessType.INSERT, bizIdName = "arg0", bizType = LogBizType.AGREEMENT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AgreementQuery agreement)
|
||||
public AjaxResult add(@RequestBody Agreement agreement)
|
||||
{
|
||||
agreement.setUserId(getUserId());
|
||||
return toAjax(agreementService.insertAgreement(agreement));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user