Compare commits
9 Commits
0fa0ace166
...
c7b9a3da9f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c7b9a3da9f | ||
![]() |
717b1f5648 | ||
![]() |
bd26ae2d34 | ||
![]() |
a5127cd50b | ||
![]() |
bd0a615254 | ||
![]() |
d5b31fded3 | ||
![]() |
c71d11ca5c | ||
![]() |
cec8b55f51 | ||
![]() |
e7246d6029 |
|
@ -48,6 +48,11 @@ public class Ad extends BaseEntity implements LogBizParam
|
||||||
@ApiModelProperty("运营区id")
|
@ApiModelProperty("运营区id")
|
||||||
private Long areaId;
|
private Long areaId;
|
||||||
|
|
||||||
|
@Excel(name = "广告状态")
|
||||||
|
@ApiModelProperty("广告状态")
|
||||||
|
@NotBlank(message = "广告状态不能为空", groups = {ValidGroup.Create.class})
|
||||||
|
private String status;
|
||||||
|
|
||||||
@Excel(name = "跳转链接")
|
@Excel(name = "跳转链接")
|
||||||
@ApiModelProperty("跳转链接")
|
@ApiModelProperty("跳转链接")
|
||||||
@NotBlank(message = "跳转链接不能为空", groups = {ValidGroup.Create.class})
|
@NotBlank(message = "跳转链接不能为空", groups = {ValidGroup.Create.class})
|
||||||
|
|
|
@ -9,8 +9,6 @@ public class AdVO extends Ad{
|
||||||
@ApiModelProperty("所属运营区")
|
@ApiModelProperty("所属运营区")
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|
||||||
@ApiModelProperty("广告审核状态")
|
|
||||||
private String auditStatus;
|
|
||||||
|
|
||||||
@ApiModelProperty("审核人")
|
@ApiModelProperty("审核人")
|
||||||
private String verifyName;
|
private String verifyName;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum AdBlong {
|
public enum AdBelong {
|
||||||
|
|
||||||
ADMIN("0", "管理员广告"),
|
ADMIN("0", "管理员广告"),
|
||||||
STORE("1", "商户广告");
|
STORE("1", "商户广告");
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ruoyi.bst.ad.domain.enums;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 允许禁用的广告状态
|
||||||
|
public static List<String> canDisable() {
|
||||||
|
return CollectionUtils.map(AdStatus::getCode, ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 允许启用的广告状态
|
||||||
|
public static List<String> canEnable() {
|
||||||
|
return CollectionUtils.map(AdStatus::getCode, DISABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="deleted" column="deleted" />
|
<result property="deleted" column="deleted" />
|
||||||
<result property="urlType" column="url_type" />
|
<result property="urlType" column="url_type" />
|
||||||
|
<result property="auditStatus" column="audit_status" />
|
||||||
|
<result property="status" column="status" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAdVo">
|
<sql id="selectAdVo">
|
||||||
|
@ -40,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bad.audit_status,
|
bad.audit_status,
|
||||||
bad.verify_end_time,
|
bad.verify_end_time,
|
||||||
bad.verify_by,
|
bad.verify_by,
|
||||||
|
bad.status,
|
||||||
bad.verify_remark,
|
bad.verify_remark,
|
||||||
ba.name AS area_name,
|
ba.name AS area_name,
|
||||||
su_verify.user_name as verify_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.deleted == null "> and bad.deleted = false</if>
|
||||||
<if test="query.auditStatus != null "> and bad.audit_status = #{query.auditStatus}</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.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(
|
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||||
null,
|
null,
|
||||||
"bad.store_id,su.agent_id",
|
"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="remark != null">remark,</if>
|
||||||
<if test="deleted != null">deleted,</if>
|
<if test="deleted != null">deleted,</if>
|
||||||
<if test="urlType != null and urlType != ''">url_type,</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>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="storeId != null">#{storeId},</if>
|
<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="remark != null">#{remark},</if>
|
||||||
<if test="deleted != null">#{deleted},</if>
|
<if test="deleted != null">#{deleted},</if>
|
||||||
<if test="urlType != null and urlType != ''">#{urlType},</if>
|
<if test="urlType != null and urlType != ''">#{urlType},</if>
|
||||||
|
<if test="auditStatus != null">#{auditStatus},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</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.auditStatus != null">audit_status = #{data.auditStatus},</if>
|
||||||
<if test="data.verifyEndTime != null">verify_end_time = #{data.verifyEndTime},</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.verifyRemark != null">verify_remark = #{data.verifyRemark},</if>
|
||||||
|
<if test="data.status != null">status = #{data.status},</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<delete id="deleteAdByAdId" parameterType="Long">
|
<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.AdVO;
|
||||||
import com.ruoyi.bst.ad.domain.AdQuery;
|
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||||
import com.ruoyi.bst.ad.domain.AdVerifyDTO;
|
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.Fault;
|
||||||
import com.ruoyi.bst.fault.domain.FaultVO;
|
import com.ruoyi.bst.fault.domain.FaultVO;
|
||||||
import com.ruoyi.bst.fault.domain.FaultVerifyDTO;
|
import com.ruoyi.bst.fault.domain.FaultVerifyDTO;
|
||||||
|
@ -72,4 +73,15 @@ public interface AdService
|
||||||
public int logicalDel(List<Long> adIds);
|
public int logicalDel(List<Long> adIds);
|
||||||
|
|
||||||
public int verify(AdVerifyDTO dto);
|
public int verify(AdVerifyDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用
|
||||||
|
*/
|
||||||
|
public int enable(Long adId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用
|
||||||
|
*/
|
||||||
|
public int disable(Long adId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.ruoyi.bst.ad.service.impl;
|
package com.ruoyi.bst.ad.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.bst.ad.domain.Ad;
|
import com.ruoyi.bst.ad.domain.Ad;
|
||||||
import com.ruoyi.bst.ad.domain.enums.AdBlong;
|
import com.ruoyi.bst.ad.domain.enums.AdBelong;
|
||||||
import com.ruoyi.bst.ad.service.AdConverter;
|
import com.ruoyi.bst.ad.service.AdConverter;
|
||||||
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,20 +13,21 @@ public class AdConverterImpl implements AdConverter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Ad toPoByCreate(Ad data) {
|
public Ad toPoByCreate(Ad data) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Ad po = new Ad();
|
Ad po = new Ad();
|
||||||
po.setBelong(data.getBelong());
|
po.setBelong(data.getBelong());
|
||||||
// 基础信息
|
// 基础信息
|
||||||
if (po.getBelong().equals(AdBlong.STORE.getCode())) {
|
if (po.getBelong().equals(AdBelong.STORE.getCode())) {
|
||||||
|
ServiceUtil.assertion(data.getAreaId()==null,"商户运营区不可以为空");
|
||||||
po.setAreaId(data.getAreaId());
|
po.setAreaId(data.getAreaId());
|
||||||
}else{
|
}else{
|
||||||
po.setAreaId(null);
|
po.setAreaId(null);
|
||||||
}
|
}
|
||||||
po.setType(data.getType());
|
po.setType(data.getType());
|
||||||
po.setPicture(data.getPicture());
|
po.setPicture(data.getPicture());
|
||||||
|
po.setStatus(data.getStatus());
|
||||||
po.setUrl(data.getUrl());
|
po.setUrl(data.getUrl());
|
||||||
po.setUrlType(data.getUrlType());
|
po.setUrlType(data.getUrlType());
|
||||||
po.setAuditStatus(data.getAuditStatus());
|
po.setAuditStatus(data.getAuditStatus());
|
||||||
|
@ -40,13 +42,14 @@ public class AdConverterImpl implements AdConverter {
|
||||||
Ad po = new Ad();
|
Ad po = new Ad();
|
||||||
// 基础信息
|
// 基础信息
|
||||||
po.setBelong(data.getBelong());
|
po.setBelong(data.getBelong());
|
||||||
if (po.getBelong().equals(AdBlong.STORE.getCode())) {
|
if (po.getBelong().equals(AdBelong.STORE.getCode())) {
|
||||||
po.setAreaId(data.getAreaId());
|
po.setAreaId(data.getAreaId());
|
||||||
}else{
|
}else{
|
||||||
po.setAreaId(null);
|
po.setAreaId(null);
|
||||||
}
|
}
|
||||||
po.setType(data.getType());
|
po.setType(data.getType());
|
||||||
po.setPicture(data.getPicture());
|
po.setPicture(data.getPicture());
|
||||||
|
po.setStatus(data.getStatus());
|
||||||
po.setUrl(data.getUrl());
|
po.setUrl(data.getUrl());
|
||||||
po.setUrlType(data.getUrlType());
|
po.setUrlType(data.getUrlType());
|
||||||
po.setAuditStatus(data.getAuditStatus());
|
po.setAuditStatus(data.getAuditStatus());
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package com.ruoyi.bst.ad.service.impl;
|
package com.ruoyi.bst.ad.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.bst.ad.domain.AdVerifyDTO;
|
import com.ruoyi.bst.ad.domain.AdVerifyDTO;
|
||||||
import com.ruoyi.bst.ad.domain.enums.AdBlong;
|
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.bst.ad.domain.enums.AdVerifyStatus;
|
||||||
import com.ruoyi.bst.ad.service.AdConverter;
|
import com.ruoyi.bst.ad.service.AdConverter;
|
||||||
import com.ruoyi.bst.area.domain.AreaVO;
|
import com.ruoyi.bst.area.domain.AreaVO;
|
||||||
import com.ruoyi.bst.area.service.AreaService;
|
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.bst.order.service.OrderService;
|
||||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
|
@ -75,10 +75,10 @@ public class AdServiceImpl implements AdService {
|
||||||
public int insertAd(Ad ad) {
|
public int insertAd(Ad ad) {
|
||||||
// 默认设置为商户广告
|
// 默认设置为商户广告
|
||||||
if (ad.getBelong() == null || ad.getBelong().equals("")) {
|
if (ad.getBelong() == null || ad.getBelong().equals("")) {
|
||||||
ad.setBelong(AdBlong.STORE.getCode());
|
ad.setBelong(AdBelong.STORE.getCode());
|
||||||
}
|
}
|
||||||
// 商户广告存在上限
|
// 商户广告存在上限
|
||||||
if (ad.getBelong().equals(AdBlong.STORE.getCode())) {
|
if (ad.getBelong().equals(AdBelong.STORE.getCode())) {
|
||||||
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||||
ad.setStoreId(area.getUserId());
|
ad.setStoreId(area.getUserId());
|
||||||
|
|
||||||
|
@ -152,13 +152,12 @@ public class AdServiceImpl implements AdService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int verify(AdVerifyDTO dto) {
|
public int verify(AdVerifyDTO dto) {
|
||||||
// 查询故障申报
|
// 查询广告
|
||||||
AdVO ad = this.selectAdByAdId(dto.getId());
|
AdVO ad = this.selectAdByAdId(dto.getId());
|
||||||
ServiceUtil.assertion(ad == null, "当前广告信息不存在", dto.getId());
|
ServiceUtil.assertion(ad == null, "当前广告信息不存在", dto.getId());
|
||||||
ServiceUtil.assertion(!AdVerifyStatus.canVerify().contains(ad.getAuditStatus()), "ID为%s的广告当前不允许审核", dto.getId());
|
ServiceUtil.assertion(!AdVerifyStatus.canVerify().contains(ad.getAuditStatus()), "ID为%s的广告当前不允许审核", dto.getId());
|
||||||
// 更新故障申报状态
|
|
||||||
boolean pass = dto.getPass() != null && dto.getPass();
|
boolean pass = dto.getPass() != null && dto.getPass();
|
||||||
// 更新故障申报状态
|
// 更新广告状态
|
||||||
Ad data = new Ad();
|
Ad data = new Ad();
|
||||||
data.setAuditStatus(pass ? AdVerifyStatus.PASSED.getCode() : AdVerifyStatus.REJECTED.getCode());
|
data.setAuditStatus(pass ? AdVerifyStatus.PASSED.getCode() : AdVerifyStatus.REJECTED.getCode());
|
||||||
data.setVerifyBy(SecurityUtils.getUserId());
|
data.setVerifyBy(SecurityUtils.getUserId());
|
||||||
|
@ -172,4 +171,22 @@ public class AdServiceImpl implements AdService {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int enable(Long adId) {
|
||||||
|
AdVO ad = this.selectAdByAdId(adId);
|
||||||
|
ServiceUtil.assertion(ad == null, "当前广告信息不存在", adId);
|
||||||
|
ServiceUtil.assertion(!AdStatus.canEnable().contains(ad.getStatus()), "广告%s当前状态不允许启用", adId);
|
||||||
|
// 更新广告状态
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int disable(Long adId) {
|
||||||
|
AdVO ad = this.selectAdByAdId(adId);
|
||||||
|
ServiceUtil.assertion(ad == null, "当前广告信息不存在", adId);
|
||||||
|
ServiceUtil.assertion(!AdStatus.canDisable().contains(ad.getStatus()), "广告%s当前状态不允许启用", adId);
|
||||||
|
// 更新广告状态
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class AgreementVO extends Agreement{
|
public class AgreementVO extends Agreement{
|
||||||
|
|
||||||
|
@ApiModelProperty("运营商ID")
|
||||||
@ApiModelProperty("商户ID")
|
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
|
|
||||||
@ApiModelProperty("商户名")
|
@ApiModelProperty("商户名")
|
||||||
|
@ -16,7 +15,7 @@ public class AgreementVO extends Agreement{
|
||||||
@ApiModelProperty("运营区")
|
@ApiModelProperty("运营区")
|
||||||
private String areaName;
|
private String areaName;
|
||||||
|
|
||||||
@ApiModelProperty("运营商ID")
|
@ApiModelProperty("代理商ID")
|
||||||
private Long agentId;
|
private Long agentId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bag.update_time,
|
bag.update_time,
|
||||||
su.nick_name as user_name,
|
su.nick_name as user_name,
|
||||||
ba.name as area_name,
|
ba.name as area_name,
|
||||||
ba.user_id as store_id
|
ba.user_id as store_id,
|
||||||
|
su.agent_id as agent_id
|
||||||
from <include refid="searchTables"/>
|
from <include refid="searchTables"/>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||||
null,
|
null,
|
||||||
"ba.user_id",
|
"ba.user_id,su.agent_id",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
query.scope
|
query.scope
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.bst.agreement.domain.AgreementVO;
|
||||||
import com.ruoyi.bst.agreement.mapper.AgreementMapper;
|
import com.ruoyi.bst.agreement.mapper.AgreementMapper;
|
||||||
import com.ruoyi.bst.agreement.service.AgreementValidator;
|
import com.ruoyi.bst.agreement.service.AgreementValidator;
|
||||||
import com.ruoyi.bst.area.domain.AreaVO;
|
import com.ruoyi.bst.area.domain.AreaVO;
|
||||||
|
import com.ruoyi.bst.area.service.AreaService;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -18,6 +19,8 @@ public class AgreementValidatorImpl implements AgreementValidator {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AgreementMapper agreementMapper;
|
private AgreementMapper agreementMapper;
|
||||||
|
@Autowired
|
||||||
|
private AreaService areaService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canEdit(Long agreementId) {
|
public boolean canEdit(Long agreementId) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.iot.service.impl;
|
package com.ruoyi.iot.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -70,10 +69,6 @@ public class IotConverterImpl implements IotConverter {
|
||||||
if (sys == null) {
|
if (sys == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 旧版硬件BUG,电压超过100V的需要除以10
|
|
||||||
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
|
||||||
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
|
||||||
}
|
|
||||||
device.setSys(sys);
|
device.setSys(sys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,12 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
IotDeviceSysInfo sys = IotUtil.toSysInfo(msg.getValue());
|
IotDeviceSysInfo sys = IotUtil.toSysInfo(msg.getValue());
|
||||||
LocalDateTime at = DateUtils.toLocalDateTime(msg.getAt());
|
LocalDateTime at = DateUtils.toLocalDateTime(msg.getAt());
|
||||||
|
|
||||||
|
// 0,0定位不处理
|
||||||
|
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
||||||
|
log.info("设备{}定位异常:{},{},不处理", msg.getDevName(), sys.getLon(), sys.getLat());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 处理设备定位BUG,若出现BUG则重启设备
|
// 处理设备定位BUG,若出现BUG则重启设备
|
||||||
int handle = this.handleDeviceLocationBug(device, sys, at);
|
int handle = this.handleDeviceLocationBug(device, sys, at);
|
||||||
if (handle == 1) {
|
if (handle == 1) {
|
||||||
|
@ -136,10 +142,6 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 0,0定位不处理
|
|
||||||
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// 相差一分钟以上的消息不做处理
|
// 相差一分钟以上的消息不做处理
|
||||||
Duration duration = Duration.between(at, LocalDateTime.now());
|
Duration duration = Duration.between(at, LocalDateTime.now());
|
||||||
if (duration.getSeconds() > 60) {
|
if (duration.getSeconds() > 60) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.iot.util;
|
package com.ruoyi.iot.util;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
@ -220,6 +221,13 @@ public class IotUtil {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return JSON.parseObject(value.toString(), IotDeviceSysInfo.class);
|
IotDeviceSysInfo sys = JSON.parseObject(value.toString(), IotDeviceSysInfo.class);
|
||||||
|
|
||||||
|
// 旧版硬件BUG,电压超过100V的需要除以10
|
||||||
|
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
||||||
|
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package com.ruoyi.web.app;
|
||||||
|
|
||||||
import com.ruoyi.bst.ad.domain.AdQuery;
|
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||||
import com.ruoyi.bst.ad.domain.AdVO;
|
import com.ruoyi.bst.ad.domain.AdVO;
|
||||||
import com.ruoyi.bst.ad.domain.enums.AdBlong;
|
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.bst.ad.domain.enums.AdVerifyStatus;
|
||||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||||
import com.ruoyi.system.user.service.UserService;
|
import com.ruoyi.system.user.service.UserService;
|
||||||
|
@ -36,14 +37,14 @@ public class AppAdController extends BaseController {
|
||||||
@Anonymous
|
@Anonymous
|
||||||
public AjaxResult getAd(AdQuery query) {
|
public AjaxResult getAd(AdQuery query) {
|
||||||
query.setAuditStatus(AdVerifyStatus.PASSED.getCode());
|
query.setAuditStatus(AdVerifyStatus.PASSED.getCode());
|
||||||
|
query.setStatus(AdStatus.ENABLE.getCode());
|
||||||
List<AdVO> list = new ArrayList<>();
|
List<AdVO> list = new ArrayList<>();
|
||||||
|
|
||||||
// 查询所属运营区的广告
|
// 查询所属运营区的广告
|
||||||
UserVO user = userService.selectUserById(getUserId());
|
UserVO user = userService.selectUserById(getUserId());
|
||||||
if (user.getAreaId() != null) {
|
if (user.getAreaId() != null) {
|
||||||
query.setAreaId(user.getAreaId());
|
query.setAreaId(user.getAreaId());
|
||||||
query.setBelong(AdBlong.STORE.getCode());
|
query.setBelong(AdBelong.STORE.getCode());
|
||||||
List<AdVO> areaAdVOList = adService.selectAdList(query);
|
List<AdVO> areaAdVOList = adService.selectAdList(query);
|
||||||
if (areaAdVOList != null) {
|
if (areaAdVOList != null) {
|
||||||
list.addAll(areaAdVOList);
|
list.addAll(areaAdVOList);
|
||||||
|
@ -52,7 +53,7 @@ public class AppAdController extends BaseController {
|
||||||
|
|
||||||
// 查询管理员发布的广告
|
// 查询管理员发布的广告
|
||||||
query.setAreaId(null);
|
query.setAreaId(null);
|
||||||
query.setBelong(AdBlong.ADMIN.getCode());
|
query.setBelong(AdBelong.ADMIN.getCode());
|
||||||
List<AdVO> adminAdVOList = adService.selectAdList(query);
|
List<AdVO> adminAdVOList = adService.selectAdList(query);
|
||||||
if (adminAdVOList != null) {
|
if (adminAdVOList != null) {
|
||||||
list.addAll(adminAdVOList);
|
list.addAll(adminAdVOList);
|
||||||
|
|
|
@ -2,9 +2,12 @@ package com.ruoyi.web.app;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||||
|
import com.ruoyi.bst.agreement.domain.AgreementVO;
|
||||||
|
import com.ruoyi.bst.agreement.domain.enums.AgreementContentType;
|
||||||
import com.ruoyi.bst.agreement.service.AgreementService;
|
import com.ruoyi.bst.agreement.service.AgreementService;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -21,16 +24,15 @@ public class AppAgreementController extends BaseController {
|
||||||
public AjaxResult getAgreement(AgreementQuery query) {
|
public AjaxResult getAgreement(AgreementQuery query) {
|
||||||
PageHelper.startPage(1, 1);
|
PageHelper.startPage(1, 1);
|
||||||
PageHelper.orderBy("create_time desc");
|
PageHelper.orderBy("create_time desc");
|
||||||
if (query.getContentType()==null) {
|
query.setContentType(AgreementContentType.TEXT.getCode());
|
||||||
return AjaxResult.error("内容类型不能为空");
|
|
||||||
}
|
|
||||||
if (query.getAgreementType()==null) {
|
if (query.getAgreementType()==null) {
|
||||||
return AjaxResult.error("协议类型不能为空");
|
return AjaxResult.error("协议类型不能为空");
|
||||||
}
|
}
|
||||||
if (query.getAreaId()==null) {
|
if (query.getAreaId()==null) {
|
||||||
return AjaxResult.error("运营区不能为空");
|
return AjaxResult.error("运营区不能为空");
|
||||||
}
|
}
|
||||||
return success(agreementService.selectAgreementList(query));
|
AgreementVO agreementVO = CollectionUtils.firstElement(agreementService.selectAgreementList(query));
|
||||||
|
return success(agreementVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class AppCustomerServiceController extends BaseController {
|
||||||
startPage();
|
startPage();
|
||||||
startOrderBy();
|
startOrderBy();
|
||||||
query.setIsEnabled(CustomerServiceStatus.ENABLE.getStatus());
|
query.setIsEnabled(CustomerServiceStatus.ENABLE.getStatus());
|
||||||
|
query.setDeleted(false);
|
||||||
return getDataTable(customerServiceService.selectCustomerServiceList(query));
|
return getDataTable(customerServiceService.selectCustomerServiceList(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.ad.domain.enums.AdBelong;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -103,6 +104,7 @@ public class AdController extends BaseController
|
||||||
ad.setAuditStatus("2");
|
ad.setAuditStatus("2");
|
||||||
} else {
|
} else {
|
||||||
ad.setAuditStatus("1");
|
ad.setAuditStatus("1");
|
||||||
|
ad.setBelong(AdBelong.STORE.getCode());
|
||||||
}
|
}
|
||||||
ad = adConverter.toPoByCreate(ad);
|
ad = adConverter.toPoByCreate(ad);
|
||||||
return toAjax(adService.insertAd(ad));
|
return toAjax(adService.insertAd(ad));
|
||||||
|
@ -154,4 +156,34 @@ public class AdController extends BaseController
|
||||||
return toAjax(adService.verify(dto));
|
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