Commit 9189e722 by weijiguang

添加错误日志

parent bff74782
...@@ -13,6 +13,8 @@ import java.util.List; ...@@ -13,6 +13,8 @@ import java.util.List;
* @date 2022-04-28 * @date 2022-04-28
*/ */
public interface SysBannerMapper { public interface SysBannerMapper {
SysBanner getBannerById(Long bannerId);
List<SysBanner> selectBanner(BannerListPo banner); List<SysBanner> selectBanner(BannerListPo banner);
Long createBanner(SysBanner banner); Long createBanner(SysBanner banner);
......
package com.soss.system.service.impl; package com.soss.system.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.soss.common.exception.ServiceException; import com.soss.common.exception.ServiceException;
import com.soss.common.utils.StringUtils; import com.soss.common.utils.StringUtils;
import com.soss.system.domain.Shop; import com.soss.system.domain.Shop;
...@@ -7,6 +8,8 @@ import com.soss.system.domain.SysBanner; ...@@ -7,6 +8,8 @@ import com.soss.system.domain.SysBanner;
import com.soss.system.domain.po.BannerListPo; import com.soss.system.domain.po.BannerListPo;
import com.soss.system.domain.po.BannerPo; import com.soss.system.domain.po.BannerPo;
import com.soss.system.domain.vo.BannerVo; import com.soss.system.domain.vo.BannerVo;
import com.soss.system.domain.vo.PushBean;
import com.soss.system.jiguang.JiGuangPushService;
import com.soss.system.mapper.ShopMapper; import com.soss.system.mapper.ShopMapper;
import com.soss.system.mapper.SysBannerMapper; import com.soss.system.mapper.SysBannerMapper;
import com.soss.system.service.ISysBannerService; import com.soss.system.service.ISysBannerService;
...@@ -38,6 +41,8 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -38,6 +41,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
private ShopMapper shopMapper; private ShopMapper shopMapper;
@Autowired @Autowired
private AreaUtil areaUtil; private AreaUtil areaUtil;
@Autowired
private JiGuangPushService jiGuangPushService;
@Override @Override
public List<SysBanner> selectBanner(BannerListPo banner) { public List<SysBanner> selectBanner(BannerListPo banner) {
...@@ -70,6 +75,14 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -70,6 +75,14 @@ public class SysBannerServiceImpl implements ISysBannerService {
banner.setUpdatedAt(new Date()); banner.setUpdatedAt(new Date());
banner.setState(0); banner.setState(0);
long i = sysBannerMapper.createBanner(banner); long i = sysBannerMapper.createBanner(banner);
try {
if (banner.getType() == 2) {
pushBannerChanged();
}
} catch (Exception e) {
e.printStackTrace();
}
return banner.getId(); return banner.getId();
} }
...@@ -99,11 +112,27 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -99,11 +112,27 @@ public class SysBannerServiceImpl implements ISysBannerService {
} }
banner.setUpdatedAt(new Date()); banner.setUpdatedAt(new Date());
long i = sysBannerMapper.updateBanner(banner); long i = sysBannerMapper.updateBanner(banner);
try {
if (banner.getType() == 2) {
pushBannerChanged();
}
} catch (Exception e) {
e.printStackTrace();
}
return i > 0 ? true : false; return i > 0 ? true : false;
} }
private void pushBannerChanged() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("action", "BANNER_CHANGED");
jsonObject.put("timestamp", System.currentTimeMillis());
PushBean pushBean = new PushBean();
pushBean.setMessageCount(jsonObject);
jiGuangPushService.pushAll(pushBean);
}
private SysBanner copyBanner(BannerPo bannerPo) { private SysBanner copyBanner(BannerPo bannerPo) {
SysBanner banner = new SysBanner(); SysBanner banner = new SysBanner();
banner.setId(bannerPo.getId()); banner.setId(bannerPo.getId());
...@@ -218,12 +247,29 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -218,12 +247,29 @@ public class SysBannerServiceImpl implements ISysBannerService {
} }
long i = sysBannerMapper.updateState(banner); long i = sysBannerMapper.updateState(banner);
try {
SysBanner sysBanner = sysBannerMapper.getBannerById(bannerId);
if (sysBanner.getType() == 2) {
pushBannerChanged();
}
} catch (Exception e) {
e.printStackTrace();
}
return i > 0 ? true : false; return i > 0 ? true : false;
} }
@Override @Override
public Boolean delete(Long bannerId) { public Boolean delete(Long bannerId) {
long i = sysBannerMapper.delete(bannerId); long i = sysBannerMapper.delete(bannerId);
try {
SysBanner sysBanner = sysBannerMapper.getBannerById(bannerId);
if (sysBanner.getType() == 2) {
pushBannerChanged();
}
} catch (Exception e) {
e.printStackTrace();
}
return i > 0 ? true : false; return i > 0 ? true : false;
} }
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
<result property="updatedAt" column="updated_at"/> <result property="updatedAt" column="updated_at"/>
</resultMap> </resultMap>
<select id="getBannerById" resultMap="BannerResult" >
select * from sys_banner where id = #{bannerId}
</select>
<select id="selectBanner" resultMap="BannerResult" parameterType="BannerListPo"> <select id="selectBanner" resultMap="BannerResult" parameterType="BannerListPo">
select * from sys_banner select * from sys_banner
<where> <where>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment