广告功能和协议完善
This commit is contained in:
parent
7fbb4c8349
commit
7b96b7f30e
|
@ -36,6 +36,10 @@ public class Ad extends BaseEntity
|
||||||
@ApiModelProperty("运营商id")
|
@ApiModelProperty("运营商id")
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
|
|
||||||
|
@Excel(name = "运营区id")
|
||||||
|
@ApiModelProperty("运营区id")
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
@Excel(name = "跳转链接")
|
@Excel(name = "跳转链接")
|
||||||
@ApiModelProperty("跳转链接")
|
@ApiModelProperty("跳转链接")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
|
@ -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 org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.security.core.parameters.P;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 广告Mapper接口
|
* 广告Mapper接口
|
||||||
|
@ -73,4 +74,8 @@ public interface AdMapper
|
||||||
public int deleteAdByAdIds(@Param("array") List<Long> adIds);
|
public int deleteAdByAdIds(@Param("array") List<Long> adIds);
|
||||||
|
|
||||||
AdVO selectOne(@Param("query") AdQuery query);
|
AdVO selectOne(@Param("query") AdQuery query);
|
||||||
|
|
||||||
|
public int logicalDel(@Param("array") List<Long> adIds);
|
||||||
|
|
||||||
|
int countByAreaId(@Param("areaId") Long areaId, @Param("adId") Long adId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
<result property="belong" column="belong" />
|
<result property="belong" column="belong" />
|
||||||
<result property="storeId" column="store_id" />
|
<result property="storeId" column="store_id" />
|
||||||
|
<result property="areaId" column="area_id" />
|
||||||
<result property="picture" column="picture" />
|
<result property="picture" column="picture" />
|
||||||
<result property="url" column="url" />
|
<result property="url" column="url" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
|
@ -21,9 +22,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAdVo">
|
<sql id="selectAdVo">
|
||||||
select
|
select DISTINCT
|
||||||
bad.ad_id,
|
bad.ad_id,
|
||||||
bad.store_id,
|
bad.store_id,
|
||||||
|
bad.area_id,
|
||||||
bad.type,
|
bad.type,
|
||||||
bad.belong,
|
bad.belong,
|
||||||
bad.picture,
|
bad.picture,
|
||||||
|
@ -35,17 +37,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bad.remark,
|
bad.remark,
|
||||||
bad.deleted,
|
bad.deleted,
|
||||||
bad.url_type,
|
bad.url_type,
|
||||||
bo.user_id,
|
ba.name AS areaName,
|
||||||
ba.name as area_name
|
su.agent_id
|
||||||
from bst_ad bad
|
from bst_ad bad
|
||||||
left join bst_area ba on bad.store_id = ba.user_id
|
left join bst_area ba on bad.area_id = ba.id
|
||||||
left join bst_order bo on ba.id = bo.area_id
|
left join bst_order bo ON ba.id = bo.area_id
|
||||||
|
left join sys_user su on bo.user_id = su.user_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
<if test="query.storeId != null and query.storeId != ''">
|
<if test="query.areaId != null and query.areaId != ''"> and bad.area_id = #{query.areaId} </if>
|
||||||
and bad.store_id = #{query.storeId}
|
<if test="query.storeId != null and query.storeId != ''"> and bad.store_id = #{query.storeId}</if>
|
||||||
</if>
|
|
||||||
<if test="query.adId != null and query.adId != ''"> and bad.ad_id = #{query.adId} </if>
|
<if test="query.adId != null and query.adId != ''"> and bad.ad_id = #{query.adId} </if>
|
||||||
<if test="query.type != null and query.type != ''"> and bad.type = #{query.type}</if>
|
<if test="query.type != null and query.type != ''"> and bad.type = #{query.type}</if>
|
||||||
<if test="query.belong != null and query.belong != ''"> and bad.belong = #{query.belong}</if>
|
<if test="query.belong != null and query.belong != ''"> and bad.belong = #{query.belong}</if>
|
||||||
|
@ -55,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<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>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||||
null,
|
null,
|
||||||
"bad.store_id,bo.user_id",
|
"bad.store_id,su.agent_id",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
query.scope
|
query.scope
|
||||||
|
@ -80,13 +82,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<where>
|
<where>
|
||||||
<include refid="searchCondition"/>
|
<include refid="searchCondition"/>
|
||||||
</where>
|
</where>
|
||||||
limit 1
|
order by bad.create_time desc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countByAreaId" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM bst_ad bad
|
||||||
|
WHERE bad.area_id = #{areaId}
|
||||||
|
AND bad.ad_id != #{adId}
|
||||||
|
AND deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertAd" parameterType="Ad" useGeneratedKeys="true" keyProperty="adId">
|
<insert id="insertAd" parameterType="Ad" useGeneratedKeys="true" keyProperty="adId">
|
||||||
insert into bst_ad
|
insert into bst_ad
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="storeId != null">store_id,</if>
|
<if test="storeId != null">store_id,</if>
|
||||||
|
<if test="areaId != null">area_id,</if>
|
||||||
<if test="type != null">type,</if>
|
<if test="type != null">type,</if>
|
||||||
<if test="belong != null">belong,</if>
|
<if test="belong != null">belong,</if>
|
||||||
<if test="picture != null">picture,</if>
|
<if test="picture != null">picture,</if>
|
||||||
|
@ -101,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="storeId != null">#{storeId},</if>
|
<if test="storeId != null">#{storeId},</if>
|
||||||
|
<if test="areaId != null">#{areaId},</if>
|
||||||
<if test="type != null">#{type},</if>
|
<if test="type != null">#{type},</if>
|
||||||
<if test="belong != null">#{belong},</if>
|
<if test="belong != null">#{belong},</if>
|
||||||
<if test="picture != null">#{picture},</if>
|
<if test="picture != null">#{picture},</if>
|
||||||
|
@ -274,10 +286,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where ad_id = #{data.adId}
|
where ad_id = #{data.adId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="logicalDel">
|
||||||
|
update bst_ad ba set ba.deleted = 1 where ba.ad_id in
|
||||||
|
<foreach item="adId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{adId}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<sql id="updateColumns">
|
<sql id="updateColumns">
|
||||||
|
<if test="data.storeId != null">store_id = #{data.storeId},</if>
|
||||||
|
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
||||||
<if test="data.type != null">type = #{data.type},</if>
|
<if test="data.type != null">type = #{data.type},</if>
|
||||||
<if test="data.picture != null">picture = #{data.picture},</if>
|
<if test="data.picture != null">picture = #{data.picture},</if>
|
||||||
<if test="data.url != null">url = #{data.url},</if>
|
<if test="data.url != null">url = #{data.url},</if>
|
||||||
|
<if test="data.belong != null">belong = #{data.belong},</if>
|
||||||
<if test="data.createBy != null">create_by = #{data.createBy},</if>
|
<if test="data.createBy != null">create_by = #{data.createBy},</if>
|
||||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||||
<if test="data.updateBy != null">update_by = #{data.updateBy},</if>
|
<if test="data.updateBy != null">update_by = #{data.updateBy},</if>
|
||||||
|
|
|
@ -63,7 +63,8 @@ public interface AdService
|
||||||
|
|
||||||
AdVO selectOne(AdQuery adQuery);
|
AdVO selectOne(AdQuery adQuery);
|
||||||
|
|
||||||
List<AdVO> toVOList();
|
|
||||||
|
|
||||||
List<AdVO> toAppVOList();
|
List<AdVO> toAppVOList();
|
||||||
|
|
||||||
|
public int logicalDel(List<Long> adIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ public class AdConverterImpl implements AdConverter {
|
||||||
@Override
|
@Override
|
||||||
public AdQuery toAdQueryByCreate(Ad ad) {
|
public AdQuery toAdQueryByCreate(Ad ad) {
|
||||||
AdQuery query = new AdQuery();
|
AdQuery query = new AdQuery();
|
||||||
query.setStoreId(ad.getStoreId());
|
query.setAreaId(ad.getAreaId());
|
||||||
|
query.setBelong(ad.getBelong());
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +30,6 @@ public class AdConverterImpl implements AdConverter {
|
||||||
public AdQuery toAdStoreVO() {
|
public AdQuery toAdStoreVO() {
|
||||||
AdQuery query = new AdQuery();
|
AdQuery query = new AdQuery();
|
||||||
query.setUserId(SecurityUtils.getUserId());
|
query.setUserId(SecurityUtils.getUserId());
|
||||||
query.setStoreId(SecurityUtils.getUserId());
|
|
||||||
query.setBelong(AdBlong.STORE.getCode());
|
query.setBelong(AdBlong.STORE.getCode());
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.ruoyi.common.core.domain.entity.User;
|
||||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
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.system.user.service.UserService;
|
import com.ruoyi.system.user.service.UserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -65,7 +66,6 @@ public class AdServiceImpl implements AdService
|
||||||
@Override
|
@Override
|
||||||
public List<AdVO> selectAdList(AdQuery ad)
|
public List<AdVO> selectAdList(AdQuery ad)
|
||||||
{
|
{
|
||||||
|
|
||||||
return adMapper.selectAdList(ad);
|
return adMapper.selectAdList(ad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,16 @@ public class AdServiceImpl implements AdService
|
||||||
@Override
|
@Override
|
||||||
public int insertAd(Ad ad)
|
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){
|
||||||
|
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||||
|
ad.setStoreId(area.getUserId());
|
||||||
|
ServiceUtil.assertion(adMapper.selectOne(query)!=null,"当前运营区存在广告已达上限");
|
||||||
|
}
|
||||||
ad.setCreateTime(DateUtils.getNowDate());
|
ad.setCreateTime(DateUtils.getNowDate());
|
||||||
return adMapper.insertAd(ad);
|
return adMapper.insertAd(ad);
|
||||||
}
|
}
|
||||||
|
@ -91,6 +101,16 @@ public class AdServiceImpl implements AdService
|
||||||
@Override
|
@Override
|
||||||
public int updateAd(Ad ad)
|
public int updateAd(Ad ad)
|
||||||
{
|
{
|
||||||
|
if (ad.getAreaId() != null){
|
||||||
|
AdVO oldAd = adMapper.selectAdByAdId(ad.getAdId());
|
||||||
|
ServiceUtil.assertion(oldAd == null,"广告不存在");
|
||||||
|
if (!oldAd.getAreaId().equals(ad.getAreaId())){
|
||||||
|
int count = adMapper.countByAreaId(ad.getAreaId(),ad.getAdId());
|
||||||
|
ServiceUtil.assertion(count>0,"该运营区下广告已达上限");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||||
|
ad.setStoreId(area.getUserId());
|
||||||
ad.setUpdateTime(DateUtils.getNowDate());
|
ad.setUpdateTime(DateUtils.getNowDate());
|
||||||
return adMapper.updateAd(ad);
|
return adMapper.updateAd(ad);
|
||||||
}
|
}
|
||||||
|
@ -124,39 +144,32 @@ public class AdServiceImpl implements AdService
|
||||||
return adMapper.selectOne(query);
|
return adMapper.selectOne(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AdVO> toVOList() {
|
|
||||||
// 管理员可以查看所有的广告
|
|
||||||
if (SecurityUtils.isAdmin()){
|
|
||||||
return adMapper.selectAdList(new AdQuery());
|
|
||||||
}
|
|
||||||
// 查询对应商户的广告
|
|
||||||
List<AdVO> voList = new ArrayList<>();
|
|
||||||
UserVO user = userService.selectUserById(SecurityUtils.getUserId());
|
|
||||||
if (user != null) {
|
|
||||||
if (user.getAreaId() != null) {
|
|
||||||
AdVO vo = adMapper.selectOne(adConverter.toAdStoreVO());
|
|
||||||
voList.add(vo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return voList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdVO> toAppVOList() {
|
public List<AdVO> toAppVOList() {
|
||||||
// 查询管理员发布的广告
|
List<AdVO> list = new ArrayList<>();
|
||||||
List<AdVO> voList = new ArrayList<>();
|
OrderQuery orderQuery = new OrderQuery();
|
||||||
List<AdVO> adminVOList = adMapper.selectAdList(adConverter.toAdAdminVO());
|
orderQuery.setUserId(SecurityUtils.getUserId());
|
||||||
|
OrderVO orderVO = orderService.selectOne(orderQuery);
|
||||||
// 查询对应商户的广告
|
// 如果有订单,查询对应商户的广告
|
||||||
UserVO user = userService.selectUserById(SecurityUtils.getUserId());
|
if (orderVO != null) {
|
||||||
if (user != null) {
|
AdQuery adStoreVO = adConverter.toAdStoreVO();
|
||||||
if (user.getAreaId() != null) {
|
adStoreVO.setStoreId(orderVO.getAreaUserId());
|
||||||
AdVO vo = adMapper.selectOne(adConverter.toAdStoreVO());
|
AdVO vo = adMapper.selectOne(adStoreVO);
|
||||||
voList.add(vo);
|
if (vo != null) {
|
||||||
|
list.add(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
voList.addAll(adminVOList);
|
// 查询管理员发布的广告
|
||||||
return voList;
|
List<AdVO> adminVOList = adMapper.selectAdList(adConverter.toAdAdminVO());
|
||||||
|
if (adminVOList != null) {
|
||||||
|
list.addAll(adminVOList);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int logicalDel(List<Long> adIds) {
|
||||||
|
return adMapper.logicalDel(adIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,4 +73,6 @@ public interface AgreementMapper
|
||||||
public int deleteAgreementByIds(@Param("array") List<Long> ids);
|
public int deleteAgreementByIds(@Param("array") List<Long> ids);
|
||||||
|
|
||||||
public AgreementVO selectDistinct(Agreement agreement);
|
public AgreementVO selectDistinct(Agreement agreement);
|
||||||
|
|
||||||
|
public AgreementVO selectLatest(AgreementQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where bag.store_id = #{storeId} and bag.agreement_type = #{agreementType} and (bag.id != #{id} or #{id} is null)
|
where bag.store_id = #{storeId} and bag.agreement_type = #{agreementType} and (bag.id != #{id} or #{id} is null)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--查询最新的协议信息-->
|
||||||
|
<select id="selectLatest" resultType="com.ruoyi.bst.agreement.domain.AgreementVO">
|
||||||
|
<include refid="selectAgreementVo"></include>
|
||||||
|
where bag.area_id = #{areaId} and bag.agreement_type = #{agreementType}
|
||||||
|
order by create_time desc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertAgreement" parameterType="Agreement" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertAgreement" parameterType="Agreement" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into bst_agreement
|
insert into bst_agreement
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
@ -35,7 +35,7 @@ public interface AgreementService
|
||||||
* @param agreement 协议
|
* @param agreement 协议
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertAgreement(Agreement agreement);
|
public int insertAgreement(AgreementQuery agreement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改协议
|
* 修改协议
|
||||||
|
@ -60,4 +60,6 @@ public interface AgreementService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteAgreementById(Long id);
|
public int deleteAgreementById(Long id);
|
||||||
|
|
||||||
|
AgreementVO selectLatest(AgreementQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||||
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.common.core.domain.vo.UserVO;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.system.user.service.UserService;
|
import com.ruoyi.system.user.service.UserService;
|
||||||
|
@ -29,6 +30,8 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
private AgreementMapper agreementMapper;
|
private AgreementMapper agreementMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AreaService areaService;
|
private AreaService areaService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询协议
|
* 查询协议
|
||||||
|
@ -61,13 +64,16 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertAgreement(Agreement agreement)
|
public int insertAgreement(AgreementQuery agreement)
|
||||||
{
|
{
|
||||||
agreement.setCreateTime(DateUtils.getNowDate());
|
agreement.setCreateTime(DateUtils.getNowDate());
|
||||||
AreaVO area = areaService.selectAreaById(agreement.getAreaId());
|
UserVO user = userService.selectUserById(agreement.getUserId());
|
||||||
if (area !=null){
|
if (user != null){
|
||||||
agreement.setStoreId(area.getUserId());
|
if (user.getAreaId() != null){
|
||||||
};
|
agreement.setAreaId(user.getAreaId());
|
||||||
|
}
|
||||||
|
agreement.setStoreId(agreement.getUserId());
|
||||||
|
}
|
||||||
distinct(agreement);
|
distinct(agreement);
|
||||||
return agreementMapper.insertAgreement(agreement);
|
return agreementMapper.insertAgreement(agreement);
|
||||||
}
|
}
|
||||||
|
@ -87,13 +93,13 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
}
|
}
|
||||||
|
|
||||||
private void distinct(Agreement agreement) {
|
private void distinct(Agreement agreement) {
|
||||||
AreaQuery areaQuery = new AreaQuery();
|
if (agreement.getAreaId() != null){
|
||||||
areaQuery.setUserId(agreement.getStoreId());
|
AreaVO area = areaService.selectAreaById(agreement.getAreaId());
|
||||||
AreaVO areaVO = areaService.selectOne(areaQuery);
|
if (area !=null){
|
||||||
if (areaVO != null) {
|
agreement.setStoreId(area.getUserId());
|
||||||
agreement.setAreaId(areaVO.getId());
|
ServiceUtil.assertion(agreementMapper.selectDistinct(agreement)!= null,"当前分类已存在协议");
|
||||||
|
};
|
||||||
}
|
}
|
||||||
ServiceUtil.assertion(agreementMapper.selectDistinct(agreement)!= null,"当前分类已存在协议");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,4 +125,14 @@ public class AgreementServiceImpl implements AgreementService
|
||||||
{
|
{
|
||||||
return agreementMapper.deleteAgreementById(id);
|
return agreementMapper.deleteAgreementById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询最新的协议信息
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AgreementVO selectLatest(AgreementQuery query) {
|
||||||
|
return agreementMapper.selectLatest(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class FaultConverterImpl implements FaultConverter {
|
||||||
po.setUserName(fault.getCreateBy());
|
po.setUserName(fault.getCreateBy());
|
||||||
po.setUserId(fault.getUserId());
|
po.setUserId(fault.getUserId());
|
||||||
|
|
||||||
|
po.setStoreId(device.getMchId());
|
||||||
if (device.getOrderId() != null && fault.getOrderId().equals(device.getOrderId())) {
|
if (device.getOrderId() != null && fault.getOrderId().equals(device.getOrderId())) {
|
||||||
po.setOrderId(device.getOrderId());
|
po.setOrderId(device.getOrderId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package com.ruoyi.web.app;
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||||
import com.ruoyi.bst.ad.service.AdService;
|
import com.ruoyi.bst.ad.service.AdService;
|
||||||
|
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||||
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.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
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.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/ad")
|
@RequestMapping("/app/ad")
|
||||||
|
@ -18,9 +20,8 @@ public class AppAdController extends BaseController {
|
||||||
|
|
||||||
@ApiOperation("获取广告")
|
@ApiOperation("获取广告")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public TableDataInfo getAd() {
|
public AjaxResult getAd() {
|
||||||
startPage();
|
return success(adService.toAppVOList());
|
||||||
return getDataTable(adService.toAppVOList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,10 @@ package com.ruoyi.web.app;
|
||||||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||||
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.page.TableDataInfo;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
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.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/agreement")
|
@RequestMapping("/app/agreement")
|
||||||
|
@ -17,12 +15,10 @@ public class AppAgreementController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AgreementService agreementService;
|
private AgreementService agreementService;
|
||||||
|
|
||||||
@ApiOperation("查询协议")
|
@ApiOperation("查询最新协议")
|
||||||
@GetMapping
|
@GetMapping("/latest")
|
||||||
public TableDataInfo getAgreement(AgreementQuery query) {
|
public AjaxResult getAgreement(AgreementQuery query) {
|
||||||
startPage();
|
return success(agreementService.selectLatest(query));
|
||||||
startOrderBy();
|
|
||||||
return getDataTable(agreementService.selectAgreementList(query));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.bst.ad.enums.AdBlong;
|
||||||
import com.ruoyi.bst.ad.service.AdConverter;
|
import com.ruoyi.bst.ad.service.AdConverter;
|
||||||
import com.ruoyi.bst.ad.service.AdService;
|
import com.ruoyi.bst.ad.service.AdService;
|
||||||
import com.ruoyi.bst.ad.service.AdValidator;
|
import com.ruoyi.bst.ad.service.AdValidator;
|
||||||
|
import com.ruoyi.bst.area.service.AreaService;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
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;
|
||||||
|
@ -42,6 +43,8 @@ public class AdController extends BaseController
|
||||||
private AdConverter adConverter;
|
private AdConverter adConverter;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdValidator adValidator;
|
private AdValidator adValidator;
|
||||||
|
@Autowired
|
||||||
|
private AreaService areaService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询广告列表
|
* 查询广告列表
|
||||||
|
@ -53,7 +56,8 @@ public class AdController extends BaseController
|
||||||
startPage();
|
startPage();
|
||||||
startOrderBy();
|
startOrderBy();
|
||||||
query.setScope(true);
|
query.setScope(true);
|
||||||
return getDataTable(adService.toVOList());
|
query.setDeleted(false);
|
||||||
|
return getDataTable(adService.selectAdList(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,14 +91,6 @@ public class AdController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody Ad ad)
|
public AjaxResult add(@RequestBody Ad ad)
|
||||||
{
|
{
|
||||||
ad.setStoreId(getUserId());
|
|
||||||
ad.setBelong(AdBlong.ADMIN.getCode());
|
|
||||||
// 若当前商户不是超级管理员只能够创建一个广告
|
|
||||||
if (!SecurityUtils.isSysAdmin()){
|
|
||||||
AdVO vo = adService.selectOne(adConverter.toAdQueryByCreate(ad));
|
|
||||||
ad.setBelong(AdBlong.ADMIN.getCode());
|
|
||||||
ServiceUtil.assertion(vo!=null,"该商户可创建广告已达上限");
|
|
||||||
}
|
|
||||||
return toAjax(adService.insertAd(ad));
|
return toAjax(adService.insertAd(ad));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +119,6 @@ public class AdController extends BaseController
|
||||||
if (!adValidator.canDeleteAll(adIds)) {
|
if (!adValidator.canDeleteAll(adIds)) {
|
||||||
return AjaxResult.error("您没有权限删除ID为" + adIds + "的广告信息");
|
return AjaxResult.error("您没有权限删除ID为" + adIds + "的广告信息");
|
||||||
}
|
}
|
||||||
return toAjax(adService.deleteAdByAdIds(adIds));
|
return toAjax(adService.logicalDel(adIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,9 @@ public class AgreementController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('bst:agreement:add')")
|
@PreAuthorize("@ss.hasPermi('bst:agreement:add')")
|
||||||
@Log(title = "协议", businessType = BusinessType.INSERT)
|
@Log(title = "协议", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody Agreement agreement)
|
public AjaxResult add(@RequestBody AgreementQuery agreement)
|
||||||
{
|
{
|
||||||
|
agreement.setUserId(getUserId());
|
||||||
return toAjax(agreementService.insertAgreement(agreement));
|
return toAjax(agreementService.insertAgreement(agreement));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user