Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bd26ae2d34
|
@ -48,6 +48,11 @@ public class Ad extends BaseEntity implements LogBizParam
|
|||
@ApiModelProperty("运营区id")
|
||||
private Long areaId;
|
||||
|
||||
@Excel(name = "广告状态")
|
||||
@ApiModelProperty("广告状态")
|
||||
@NotBlank(message = "广告状态不能为空", groups = {ValidGroup.Create.class})
|
||||
private String status;
|
||||
|
||||
@Excel(name = "跳转链接")
|
||||
@ApiModelProperty("跳转链接")
|
||||
@NotBlank(message = "跳转链接不能为空", groups = {ValidGroup.Create.class})
|
||||
|
|
|
@ -9,8 +9,6 @@ public class AdVO extends Ad{
|
|||
@ApiModelProperty("所属运营区")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty("广告审核状态")
|
||||
private String auditStatus;
|
||||
|
||||
@ApiModelProperty("审核人")
|
||||
private String verifyName;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.ruoyi.bst.ad.domain.enums;
|
||||
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdStatus {
|
||||
|
||||
DISABLE("0", "禁用"),
|
||||
ENABLE("1", "启用");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
|
||||
}
|
|
@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="remark" column="remark" />
|
||||
<result property="deleted" column="deleted" />
|
||||
<result property="urlType" column="url_type" />
|
||||
<result property="auditStatus" column="audit_status" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAdVo">
|
||||
|
@ -40,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bad.audit_status,
|
||||
bad.verify_end_time,
|
||||
bad.verify_by,
|
||||
bad.status,
|
||||
bad.verify_remark,
|
||||
ba.name AS area_name,
|
||||
su_verify.user_name as verify_name,
|
||||
|
@ -62,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.deleted == null "> and bad.deleted = false</if>
|
||||
<if test="query.auditStatus != null "> and bad.audit_status = #{query.auditStatus}</if>
|
||||
<if test="query.urlType != null and query.urlType != ''"> and bad.url_type = #{query.urlType}</if>
|
||||
<if test="query.status != null and query.status != ''"> and bad.status = #{query.status}</if>
|
||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||
null,
|
||||
"bad.store_id,su.agent_id",
|
||||
|
@ -116,6 +120,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">remark,</if>
|
||||
<if test="deleted != null">deleted,</if>
|
||||
<if test="urlType != null and urlType != ''">url_type,</if>
|
||||
<if test="auditStatus != null and auditStatus != ''">audit_status,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
|
@ -131,6 +137,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">#{remark},</if>
|
||||
<if test="deleted != null">#{deleted},</if>
|
||||
<if test="urlType != null and urlType != ''">#{urlType},</if>
|
||||
<if test="auditStatus != null">#{auditStatus},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -328,6 +336,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="data.auditStatus != null">audit_status = #{data.auditStatus},</if>
|
||||
<if test="data.verifyEndTime != null">verify_end_time = #{data.verifyEndTime},</if>
|
||||
<if test="data.verifyRemark != null">verify_remark = #{data.verifyRemark},</if>
|
||||
<if test="data.status != null">status = #{data.status},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteAdByAdId" parameterType="Long">
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.bst.ad.domain.Ad;
|
|||
import com.ruoyi.bst.ad.domain.AdVO;
|
||||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import com.ruoyi.bst.ad.domain.AdVerifyDTO;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.fault.domain.Fault;
|
||||
import com.ruoyi.bst.fault.domain.FaultVO;
|
||||
import com.ruoyi.bst.fault.domain.FaultVerifyDTO;
|
||||
|
@ -72,4 +73,15 @@ public interface AdService
|
|||
public int logicalDel(List<Long> adIds);
|
||||
|
||||
public int verify(AdVerifyDTO dto);
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
public int enable(Long adId);
|
||||
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
public int disable(Long adId);
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class AdConverterImpl implements AdConverter {
|
|||
}
|
||||
po.setType(data.getType());
|
||||
po.setPicture(data.getPicture());
|
||||
|
||||
po.setStatus(data.getStatus());
|
||||
po.setUrl(data.getUrl());
|
||||
po.setUrlType(data.getUrlType());
|
||||
po.setAuditStatus(data.getAuditStatus());
|
||||
|
@ -49,6 +49,7 @@ public class AdConverterImpl implements AdConverter {
|
|||
}
|
||||
po.setType(data.getType());
|
||||
po.setPicture(data.getPicture());
|
||||
po.setStatus(data.getStatus());
|
||||
po.setUrl(data.getUrl());
|
||||
po.setUrlType(data.getUrlType());
|
||||
po.setAuditStatus(data.getAuditStatus());
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.ruoyi.bst.ad.domain.enums.AdVerifyStatus;
|
|||
import com.ruoyi.bst.ad.service.AdConverter;
|
||||
import com.ruoyi.bst.area.domain.AreaVO;
|
||||
import com.ruoyi.bst.area.service.AreaService;
|
||||
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
|
||||
import com.ruoyi.bst.order.service.OrderService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
@ -150,13 +151,12 @@ public class AdServiceImpl implements AdService {
|
|||
|
||||
@Override
|
||||
public int verify(AdVerifyDTO dto) {
|
||||
// 查询故障申报
|
||||
// 查询广告
|
||||
AdVO ad = this.selectAdByAdId(dto.getId());
|
||||
ServiceUtil.assertion(ad == null, "当前广告信息不存在", dto.getId());
|
||||
ServiceUtil.assertion(!AdVerifyStatus.canVerify().contains(ad.getAuditStatus()), "ID为%s的广告当前不允许审核", dto.getId());
|
||||
// 更新故障申报状态
|
||||
boolean pass = dto.getPass() != null && dto.getPass();
|
||||
// 更新故障申报状态
|
||||
// 更新广告状态
|
||||
Ad data = new Ad();
|
||||
data.setAuditStatus(pass ? AdVerifyStatus.PASSED.getCode() : AdVerifyStatus.REJECTED.getCode());
|
||||
data.setVerifyBy(SecurityUtils.getUserId());
|
||||
|
@ -170,4 +170,18 @@ public class AdServiceImpl implements AdService {
|
|||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int enable(Long adId) {
|
||||
AdVO ad = this.selectAdByAdId(adId);
|
||||
ServiceUtil.assertion(ad == null, "当前广告信息不存在", adId);
|
||||
ServiceUtil.assertion(!DeviceStatus.canEnable().contains(ad.getStatus()), "广告%s当前状态不允许启用", adId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int disable(Long adId) {
|
||||
AdVO ad = this.selectAdByAdId(adId);
|
||||
ServiceUtil.assertion(ad == null, "当前广告信息不存在", adId);
|
||||
ServiceUtil.assertion(!DeviceStatus.canDisable().contains(ad.getStatus()), "广告%s当前状态不允许启用", adId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.web.app;
|
|||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import com.ruoyi.bst.ad.domain.AdVO;
|
||||
import com.ruoyi.bst.ad.domain.enums.AdBelong;
|
||||
import com.ruoyi.bst.ad.domain.enums.AdStatus;
|
||||
import com.ruoyi.bst.ad.domain.enums.AdVerifyStatus;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.system.user.service.UserService;
|
||||
|
@ -36,7 +37,7 @@ public class AppAdController extends BaseController {
|
|||
@Anonymous
|
||||
public AjaxResult getAd(AdQuery query) {
|
||||
query.setAuditStatus(AdVerifyStatus.PASSED.getCode());
|
||||
|
||||
query.setStatus(AdStatus.ENABLE.getCode());
|
||||
List<AdVO> list = new ArrayList<>();
|
||||
|
||||
// 查询所属运营区的广告
|
||||
|
|
|
@ -156,4 +156,34 @@ public class AdController extends BaseController
|
|||
return toAjax(adService.verify(dto));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bst:ad:enable')")
|
||||
@Log(title = "广告启用", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.AD)
|
||||
@ApiOperation("广告启用")
|
||||
@PutMapping("/enable")
|
||||
public AjaxResult enableAd(@RequestBody Long id) {
|
||||
if (!adValidator.canEdit(id)){
|
||||
return error("您无权启用id为"+ id +"的广告");
|
||||
}
|
||||
int count = adService.enable(id);
|
||||
if (count == 0) {
|
||||
return error("启用失败");
|
||||
}
|
||||
return toAjax(count);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bst:ad:disable')")
|
||||
@Log(title = "广告禁用", businessType = BusinessType.OTHER, bizIdName = "arg0", bizType = LogBizType.AD)
|
||||
@ApiOperation("广告禁用")
|
||||
@PutMapping("/disable")
|
||||
public AjaxResult disableAd(@RequestBody Long id) {
|
||||
if (!adValidator.canEdit(id)){
|
||||
return error("您无权禁用id为"+ id +"的广告");
|
||||
}
|
||||
int count = adService.disable(id);
|
||||
if (count == 0) {
|
||||
return error("禁用失败");
|
||||
}
|
||||
return toAjax(count);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user